From 15239ff74d7f79dd153a2f0ed9f1d92b8d825f57 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 3 May 2021 11:47:29 +0200 Subject: [PATCH] channelmix: only run the LFE filter when upmixing Only run the lowpass filter on the LFE channel when we are upmixing and there is a valid cutoff frequency defined. Otherwise we might filter away a valid LFE channel. Fixes: rhbz#1941366 --- spa/plugins/audioconvert/channelmix-ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/channelmix-ops.c b/spa/plugins/audioconvert/channelmix-ops.c index ea625c6e1..27e4eebf4 100644 --- a/spa/plugins/audioconvert/channelmix-ops.c +++ b/spa/plugins/audioconvert/channelmix-ops.c @@ -150,6 +150,7 @@ static int make_matrix(struct channelmix *mix) float slev = SQRT1_2; float llev = 0.5f; float maxsum = 0.0f; + bool do_upmix = SPA_FLAG_IS_SET(mix->options, CHANNELMIX_OPTION_UPMIX); #define _MATRIX(s,d) matrix[_CH(s)][_CH(d)] spa_log_debug(mix->log, "src-mask:%08"PRIx64" dst-mask:%08"PRIx64, @@ -363,7 +364,7 @@ static int make_matrix(struct channelmix *mix) } } - if (!SPA_FLAG_IS_SET(mix->options, CHANNELMIX_OPTION_UPMIX)) + if (!do_upmix) goto done; unassigned = dst_mask & ~src_mask; @@ -425,7 +426,7 @@ done: sum += fabs(matrix[i][j]); } maxsum = SPA_MAX(maxsum, sum); - if (i == _CH(LFE)) { + if (i == _CH(LFE) && do_upmix && mix->lfe_cutoff > 0.0f) { spa_log_debug(mix->log, "channel %d is LFE", ic); lr4_set(&mix->lr4[ic], BQ_LOWPASS, mix->lfe_cutoff / mix->freq); mix->lr4_info[ic] = 1;