channelmix: improve mixing setup

Handle MONO layout as a real layout, not just like FC. This means it
does not share the FC mixing weights.
Only distribute and combine MONO channels when the target is also
MONO, enable normalization in this case.
Otherwise downmix and upmix the mono channels like any other channel,
which will make it respect the upmix and other settings.
Change some tests with this new way of doing things.

Fixes #3010
This commit is contained in:
Wim Taymans 2023-02-06 21:05:23 +01:00
parent 987b772b97
commit b9999b292d
3 changed files with 191 additions and 89 deletions

View file

@ -38,6 +38,7 @@
#include <spa/node/node.h>
#include <spa/node/io.h>
#include <spa/debug/mem.h>
#include <spa/debug/log.h>
#include <spa/support/log-impl.h>
SPA_LOG_IMPL(logger);
@ -682,8 +683,10 @@ static int run_convert(struct context *ctx, struct data *in_data,
res = memcmp(b->datas[j].data, out_data->data[k], out_data->size);
if (res != 0) {
fprintf(stderr, "error port %d plane %d\n", i, j);
spa_debug_mem(0, b->datas[j].data, out_data->size);
spa_debug_mem(0, out_data->data[k], out_data->size);
spa_debug_log_mem(&logger.log, SPA_LOG_LEVEL_WARN,
0, b->datas[j].data, out_data->size);
spa_debug_log_mem(&logger.log, SPA_LOG_LEVEL_WARN,
2, out_data->data[k], out_data->size);
}
spa_assert_se(res == 0);