From ce4cd06405d3697ddc247be7322ad51cdc53e2d6 Mon Sep 17 00:00:00 2001 From: Bartosz Kokoszko Date: Mon, 15 Feb 2021 09:51:30 +0100 Subject: [PATCH] demux: fix demux look up table preparation Array streams represents streams on "many" side i.e. input for MUX and output for DEMUX. For DEMUX each stream has masks array - 1 mask per output channel. Each mask shows, from which input channel data should be taken. This commit reverts "demux" part of commit: "b1b31e7154a5c159d81459634eabd8013b434181" Signed-off-by: Bartosz Kokoszko --- src/audio/mux/mux_generic.c | 6 +++--- test/cmocka/src/audio/mux/demux_copy.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/audio/mux/mux_generic.c b/src/audio/mux/mux_generic.c index cd8a08c3e..4593d76e1 100644 --- a/src/audio/mux/mux_generic.c +++ b/src/audio/mux/mux_generic.c @@ -524,9 +524,9 @@ void demux_prepare_look_up_table(struct comp_dev *dev) for (j = 0; j < PLATFORM_MAX_CHANNELS; j++) { for (k = 0; k < PLATFORM_MAX_CHANNELS; k++) { if (cd->config.streams[i].mask[j] & BIT(k)) { - /* MUX component has only one sink */ - cd->lookup[i].copy_elem[idx].in_ch = j; - cd->lookup[i].copy_elem[idx].out_ch = k; + /* DEMUX component has only one source */ + cd->lookup[i].copy_elem[idx].in_ch = k; + cd->lookup[i].copy_elem[idx].out_ch = j; cd->lookup[i].copy_elem[idx].stream_id = i; cd->lookup[i].num_elems = ++idx; diff --git a/test/cmocka/src/audio/mux/demux_copy.c b/test/cmocka/src/audio/mux/demux_copy.c index 71e0d4bf6..2ee47477c 100644 --- a/test/cmocka/src/audio/mux/demux_copy.c +++ b/test/cmocka/src/audio/mux/demux_copy.c @@ -197,7 +197,7 @@ static void test_demux_copy_proc_16(void **state) int64_t sample = 0; for (k = 0; k < PLATFORM_MAX_CHANNELS; ++k) - if (td->mask[i][k] & BIT(j)) + if (td->mask[i][j] & BIT(k)) sample = input_16b[k]; expected_results[i][j] = sample; @@ -222,7 +222,7 @@ static void test_demux_copy_proc_24(void **state) int32_t sample = 0; for (k = 0; k < PLATFORM_MAX_CHANNELS; ++k) - if (td->mask[i][k] & BIT(j)) + if (td->mask[i][j] & BIT(k)) sample = input_24b[k]; expected_results[i][j] = sample; @@ -247,7 +247,7 @@ static void test_demux_copy_proc_32(void **state) int32_t sample = 0; for (k = 0; k < PLATFORM_MAX_CHANNELS; ++k) - if (td->mask[i][k] & BIT(j)) + if (td->mask[i][j] & BIT(k)) sample = input_32b[k]; expected_results[i][j] = sample;