Skip to content

MUX: Generic Mux component implementation. - #1275

Merged
lgirdwood merged 1 commit into
thesofproject:masterfrom
akloniex:mux
May 29, 2019
Merged

lgirdwood merged 1 commit into
thesofproject:masterfrom
akloniex:mux

Conversation

@akloniex

@akloniex akloniex commented Apr 16, 2019 •

Copy link
Copy Markdown
Member

Mux component implementation. Support for mux and demux operation
modes, channel routing and summation with sturation.

Signed-off-by: ArturX Kloniecki arturx.kloniecki@linux.intel.com

Mux component can operate in 2 modes:

  • demux - with single input stream and multiple output streams (up to MUX_MAX_STREAMS, defined in header)
  • mux - with multiple input streams and single output stream

It can also work with 1:1 I/O in both modes to act as channel router / summator.

It is configured via binary blob specifying channel routing using bitmasks.
In case of demux mode every output stream has an array of bitmasks, one mask per channel, specifying which of the input channels should be used to compose it.
Similarly for mux, each input stream has bitmask for each of it's channels to specify to which output channel it contributes.

@tlauda tlauda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Initial review.
Many changes not related to mux implementation need to be extracted to separate PR.

Comment thread src/audio/buffer.c Resolved
Comment thread src/audio/host.c Resolved
Comment thread src/audio/host.c Resolved
Comment thread src/audio/host.c Resolved
Comment thread src/audio/pipeline.c Resolved
Comment thread src/audio/mux.h Resolved
Comment thread src/audio/mux.h Resolved
Comment thread src/audio/mux_generic.c Resolved
Comment thread src/audio/mux_generic.c Resolved
Comment thread src/audio/mux.c Resolved
@akloniex
akloniex force-pushed the mux branch 4 times, most recently from 65185e1 to 49f10ea Compare April 16, 2019 23:41
Comment thread src/audio/mux.c Resolved
@lgirdwood

Copy link
Copy Markdown
Member

@akloniex there are also some CI failures to fix too.

@akloniex
akloniex force-pushed the mux branch 2 times, most recently from 8f4cc68 to cd7b61f Compare April 18, 2019 23:43
@akloniex
akloniex requested a review from tlauda April 18, 2019 23:48
Comment thread src/audio/mux.h
union {
mux_func mux;
demux_func demux;
};

@ranj063 ranj063 Apr 19, 2019 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@akloniex I think we should remove the union and replace it with one function. Then we can simplify a bunch of other duplicated code. see my other comments

Comment thread src/audio/mux_generic.c
}

return NULL;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we only have one function in the comp_data, we can pass the mode, and pick the appropriate function instead of 2 separate functions which have the exact same logic

Comment thread src/audio/mux.c Outdated
ret = -EINVAL;
goto err;
}
} else {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here remove duplication and pass mode to get_processing_function()

@ranj063

ranj063 commented Apr 19, 2019

Copy link
Copy Markdown
Collaborator

@akloniex also the mux_process and demux_process functions seems to mirrored code. Is there a way we can use one function and set the source/sink based on mode. might be worth giving it a try.

Comment thread src/audio/mux.h Resolved
Comment thread src/audio/mux.h Resolved
Comment thread src/audio/mux.h Resolved
Comment thread src/audio/mux.h Outdated
uint8_t mask[PLATFORM_MAX_CHANNELS];
};

typedef void(*mux_func)(struct comp_dev *dev, struct comp_buffer *sink,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If this is a public API header (looks like), do those functions prototypes need to be exposed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is public API header, and these functions do not need to be exposed, you're correct.
These functions are meant to be used by mux privately, althought, my thought process behind exposing these was to provide interface, used in mux.c file (which handles all general component duties) and implemented in mux_generic.c file (and to be implemented using hifi functions).
I could add another, private, header to provide the interface, but thought that it would look much cleaner the way it is right now.
But I won't fight for it if you think that hiding these details in private header or by calling extern functions would work better.

Comment thread src/audio/mux.c Resolved
Comment thread src/audio/mux.c Resolved
@juimonen

Copy link
Copy Markdown

So is this supposed to be "processing component" or "mux" from alsa and topology perspective? check what we did for e.g. with selector... this will effect the implementation on the driver side. If it is "processing" it is easier. With general "mux" component we have to think more carefully what is the control interface etc...

@juimonen

Copy link
Copy Markdown

still to emphasize, we should not just use binary control always if it makes thing easier. Currently it is also cumbersome as we need an alsa control for it (even though it is not ever used). With eq's it is natural because we are sending variable length coefficients and it makes no sense to define fixed filter coefficients (length wise). If mux is for general use we should define the parameters with tuples in topology.

@dbaluta

dbaluta commented Apr 23, 2019 •

Copy link
Copy Markdown
Collaborator

@akloniex

* mux - with single input stream and multiple output streams (up to MUX_MAX_STREAMS, defined in header)

* demux - with multiple input streams and single output stream

Isn't the naming the other way around? I mean a muxer has multiple inputs and single output.

@akloniex

Copy link
Copy Markdown
Member Author

@juimonen
This component should operate as processing component under ALSA classification, and I'm now adjusting implementation to match that.
Also, I will add configuration at instantiation.

@juimonen

juimonen commented May 9, 2019

Copy link
Copy Markdown

corresponding ABI change in driver:
thesofproject/linux#870

@akloniex
akloniex force-pushed the mux branch 5 times, most recently from 3c3b409 to b7fc384 Compare May 14, 2019 12:19
@akloniex
akloniex requested a review from jajanusz May 14, 2019 12:19

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@akloniex there are some C++ style comments which can be fixed incrementally in another PR

@jajanusz jajanusz left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part related to mux is ok for initial version, but it looks that we sitll didn't decide what to do with dependency of it -> #1383
So I 'request changes' just to not merge PR that it includes by accident.

@akloniex
akloniex force-pushed the mux branch 2 times, most recently from 31d19ec to 7d2b058 Compare May 21, 2019 18:42
@juimonen

Copy link
Copy Markdown

@jajanusz there's now some kind of solution in #1383 and I think @akloniex updated it to this PR also. You should see if this is suitable for you (and maybe @tlauda also)..

I was testing this with mixer and demux pipeline in up2 and they both seem to work, so I didn't see any regressions there...

@jajanusz

Copy link
Copy Markdown
Contributor

@jajanusz there's now some kind of solution in #1383 and I think @akloniex updated it to this PR also. You should see if this is suitable for you (and maybe @tlauda also)..

I was testing this with mixer and demux pipeline in up2 and they both seem to work, so I didn't see any regressions there...

It's good, I'll just keep as Request changes until #1383 will be merged.

@lgirdwood

Copy link
Copy Markdown
Member

@jajanusz @mmaka1 @tlauda have your review comments been addressed ?

@jajanusz

Copy link
Copy Markdown
Contributor

@lgirdwood I just need more reviews in #1383 ;)

@jajanusz

Copy link
Copy Markdown
Contributor

@lgirdwood BTW IMO it's bad idea to split dependency into another PR, because it causes mess like this one. If it's not that big it's better to just make it another commit in the same PR, this way you have something+it's dependency in 1 place and in the end it looks the same in git history. It would be problematic only if you have super long conversations mixed when some of texts are for original PR and some for dependency.

Mux component implementation. Support for mux and demux operation
modes, channel routing and summation with saturation.

Mux component can operate in 2 modes:

demux - with single input stream and multiple output streams
(up to MUX_MAX_STREAMS)
mux - with multiple input streams and single output stream
It can also work with 1:1 I/O in both modes to act as
channel router / summator.

It is configured via binary blob specifying channel routing
using bitmasks.
In case of demux mode every output stream has an array of bitmasks,
one mask per channel, specifying which of the input channels should
be used to compose it.
Similarly for mux, each input stream has bitmask for each of it's
channels to specify to which output channel it contributes.

Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
@jajanusz

Copy link
Copy Markdown
Contributor

@tlauda @mmaka1 ping

@wenqingfu

Copy link
Copy Markdown

@lgirdwood BTW IMO it's bad idea to split dependency into another PR, because it causes mess like this one. If it's not that big it's better to just make it another commit in the same PR, this way you have something+it's dependency in 1 place and in the end it looks the same in git history. It would be problematic only if you have super long conversations mixed when some of texts are for original PR and some for dependency.

We need to remind and reinforce "master first" policy, too... And, corresponding patch in the driver repository has thesofproject/linux#870 has been merged, so ping @tlauda @mmaka1

@akloniex akloniex changed the title [RFC] MUX: Generic Mux component implementation. MUX: Generic Mux component implementation. May 29, 2019
@lgirdwood
lgirdwood merged commit 529bf68 into thesofproject:master May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ABI ABI change involved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants