Skip to content

[BUG]DEMUX comp not work normally with channel 4 to 2 with format conversion #2959

Closed

Description

@xiulipan

Describe the bug
Used to be #2533
The DEMUX should copy the data from source to sink without any error, but now with DEMXU comp, the copy out data is broken when copy channel 4 to channel 2 with format conversion

To Reproduce
Use demux test tplg sof-apl-demux-pcm512x.tplg (#2958 ) to replace the sof-apl-nocodec.tplg with sof-apl-demux-nocodec.tplg

aplay -Dhw:0,0 -f s32_le -c 4 -r 48000 wav/32le-4ch-sin-100-400hz.wav -vvv
arecord -Dhw:0,4 -f s16_le -c 2 -r 48000 2ch_s16.wav -vvv
arecord -Dhw:0,4 -f s32_le -c 2 -r 48000 2ch_s32.wav -vvv

Reproduction Rate
100%

Expected behavior
The record wav should be same with s16le and s32le

Impact
This will be a stopper for echo reference and smart amplifier

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
  2. Name of the topology file
    • Topology: sof-apl-demux-nocodec.tplg rename to sof-apl-nocodec.tplg
  3. Name of the platform(s) on which the bug is observed.
    • Platform: APL

Screenshots or console output

image
All wav files and trace log attached.
wavandlog.zip

Activity

  1. added
    bugSomething isn't working as expected
    on May 20, 2020
  2. juimonen commented on May 20, 2020

    @juimonen

    @xiulipan can you still be more specific, so you are playing s32, so is the 32 or 16 bit demux data broken?

  3. juimonen commented on May 20, 2020

    @juimonen

    @xiulipan although all bugs are bad, we should probably try playing S16 data as I don't see too many user space folks/apps ever using s32. Demux should be able to convert this to s32/s24 if some fw internal component uses that (or use the original S16).

    Or is CRAS for example playing s32? just checking here, as I don't know...

  4. xiulipan commented on May 20, 2020

    @xiulipan
    ContributorAuthor

    @juimonen Playing s32 and demux extract s16 is broken.
    I will try to playback s16 and update the test case. Not sure what CRAS will behave
    @keyonjie Could you help to give more info with the smart amp usage here?

  5. xiulipan commented on May 20, 2020

    @xiulipan
    ContributorAuthor

    @juimonen with s16 source. the s32 demux is not working. So I think we do not support format switch in the demxu.
    image

  6. keyonjie commented on May 20, 2020

    @keyonjie
    Contributor

    yes, @xiulipan mux/demux is expected to do channel mux/demux only, no sample rate or sample format changing inside it.

  7. lgirdwood commented on May 20, 2020

    @lgirdwood
    Member

    Can we fix demux #2687 please. This will greatly simplify the code too. i.e.

    /* stores all copy src/dest with increments - built during prepare() */
    struct copy_elem {
        void * src;
        int src_increment;
        void *dest;
        int dest_increment;
    };
    
    /* copy - check for overflow BEFORE copy and alter num_copies to fit */
    for (i = 0; i < num_copies; i++) {
        for (j = 0; j < num_elems; j++) {
            memcpy(elem[j].dest, elem[j].src, size); // memcpy used as example, but do this directly to save func call
            elem[j].dest += elem[j].dest_increment;
            elem[j].src += elem[j].src_increment;
        }
    }
  8. keyonjie commented on May 21, 2020

    @keyonjie
    Contributor

    @mmaka1 has a discussion topic related to this here: https://github.com/orgs/thesofproject/teams/sof-developers/discussions/38

    I am not clear what the implementation plan for that, but the PR #2788 should help to reject and avoid getting and providing wrong data to the user space.

  9. lgirdwood commented on May 21, 2020

    @lgirdwood
    Member

    @keyonjie @xiulipan I want demux/mux to only to muxing and demuxing only. No mixing or format conversions please. I am not following from your comments if you are aligned with this ?

  10. keyonjie commented on May 21, 2020

    @keyonjie
    Contributor

    @keyonjie @xiulipan I want demux/mux to only to muxing and demuxing only. No mixing or format conversions please. I am not following from your comments if you are aligned with this ?

    I got your point, but looks nobody is working on that #2687, everybody is waiting for the mux/demux author @akloniex to work on that?

  11. lgirdwood commented on May 21, 2020

    @lgirdwood
    Member
  12. slawblauciak commented on Jun 2, 2020

    @slawblauciak
    Collaborator

    Please verify topology and DAI configuration, which is responsible for format conversion.

  13. xiulipan commented on Jun 3, 2020

    @xiulipan
    ContributorAuthor

    Close as this is not an issue, we have limitation with format convert.
    @keyonjie has #2788 to solve this kind of wrong usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Mux/DemuxbugSomething isn't working as expected

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions