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

Audio: Crossover: Convert to module adapter #7871

Merged
merged 2 commits into from
Aug 18, 2023

Conversation

singalsu
Copy link
Collaborator

This patch contains basic changes to run crossover component as module adapter client in IPC3 system. Additional changes are needed for IPC4.

@singalsu singalsu requested a review from a team June 28, 2023 16:10
@singalsu singalsu changed the title [SKIP SOF-TEST] Audio: Crossover: Convert to module adapter Audio: Crossover: Convert to module adapter Jun 29, 2023
sinks_c[i] = buffer_acquire(sinks[i]);
avail = audio_stream_avail_frames(&source_c->stream,
&sinks_c[i]->stream);
frames = MIN(frames, avail);
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic seems to be removed by the commit, is it intentional?
It looks important that determines the processed frames with regard to sink capacities in case of overrun.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as Curtis asked? The module adapter does this for clients. Though there's also the sinks[i] NULL case if states are not equal. I have not been able to create such test situation, could a NULL sink impact the avail/free. I'm not sure.


/* Validate frame format and buffer size of sinks */
list_for_item(sink_list, &dev->bsink_list) {
sink = container_of(sink_list, struct comp_buffer, source_list);
sink_c = buffer_acquire(sink);

/* Note: Printing pipeline IDs for debug, these are with IPC4 zeros, probably due
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the bug you mentioned still exist under IPC4? If yes, is it worked-around by the commit, or is it non-critical?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm now after vacation starting to study this again -- I hope I'll gain understanding of IPC4 to be able to address this.

@singalsu singalsu force-pushed the crossover_module_convert branch 3 times, most recently from a7b2560 to dfe5fc7 Compare August 8, 2023 16:06
@singalsu singalsu requested a review from ranj063 August 8, 2023 16:10
@singalsu
Copy link
Collaborator Author

singalsu commented Aug 8, 2023

Crossover now runs with this PR correctly with IPC4 and IPC3, so changing this to non-draft. I'm able to run 2-way configuration with UPX board in nocodec mode. I play one stream and capture back from SSP loopback paths the band filtered filters versions those appear to be OK.

The other patches those belong to this work are:

@singalsu singalsu marked this pull request as ready for review August 8, 2023 17:08
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.

Thanks @singalsu ! I think there is one req-for-an-inline-comment outstanding, but otherwise looks good to go.

src/audio/crossover/crossover.c Show resolved Hide resolved
src/include/sof/audio/component.h Show resolved Hide resolved
&sinks_c[i]->stream);
frames = MIN(frames, avail);
/* Process crossover */
if (frames) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: an easier form would be

if (!frames)
    return -ENODATA;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, done

}

audio_stream_init_alignment_constants(1, 1, &sink_c->stream);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this needs to be done even if the formats didn't match and we're going to error out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, ordered this way for more compact appear with my style but done now.

goto out;
return ret;

audio_stream_init_alignment_constants(1, 1, &sink_c->stream);
Copy link
Collaborator

Choose a reason for hiding this comment

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

no, this cannot be done here - cannot use sink_c after releasing

This patch contains the changes to run crossover component as
module adapter client in IPC3 and IPC4 systems. The largest change
is to use pin indices in IPC4 instead of pipeline IDs to identify
sink streams. Pipeline IDs on firmware side are temporary in IPC4.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The filters state need to be retrieved for every channel as
it is done in other s16 and s24 processing cores. The mistake
caused very distorted sound with waveform discontinuity every
copy period, e.g. 1 ms.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
src/include/sof/audio/component.h Show resolved Hide resolved
@lgirdwood
Copy link
Member

@wszypelt @lrudyX good to merge ? IIUC, crossover not tested by internal CI today.

@lrudyX
Copy link

lrudyX commented Aug 18, 2023

@wszypelt @lrudyX good to merge ? IIUC, crossover not tested by internal CI today.

It is waiting in queue. I have moved it to the top. We had some problems with DUTs.

@lrudyX
Copy link

lrudyX commented Aug 18, 2023

@lgirdwood Internal CI result is pass :)

@cujomalainey cujomalainey merged commit df460c8 into thesofproject:main Aug 18, 2023
41 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.

8 participants