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
This commit is contained in:
Wim Taymans 2021-05-03 11:47:29 +02:00
parent 3c11b75e32
commit 15239ff74d

View file

@ -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;