Simple upmix of stereo inputs up to 7.1 output

This commit is contained in:
fdev31 2021-03-05 21:12:55 +01:00 committed by Wim Taymans
parent 5712992fc9
commit 4d21b5f8bd

View file

@ -155,6 +155,8 @@ static const struct channelmix_info *find_channelmix_info(uint32_t src_chan, uin
#define _MASK(ch) (1ULL << SPA_AUDIO_CHANNEL_ ## ch) #define _MASK(ch) (1ULL << SPA_AUDIO_CHANNEL_ ## ch)
#define STEREO (_MASK(FL)|_MASK(FR)) #define STEREO (_MASK(FL)|_MASK(FR))
#define DUAL_STEREO (_MASK(RL)|_MASK(RR))
#define QUAD_STEREO (_MASK(SL)|_MASK(SR))
static int make_matrix(struct channelmix *mix) static int make_matrix(struct channelmix *mix)
{ {
@ -218,6 +220,18 @@ static int make_matrix(struct channelmix *mix)
} }
} }
if (mix->src_chan <= 3 && (src_mask & STEREO) == STEREO && (dst_mask & DUAL_STEREO) == DUAL_STEREO) {
spa_log_debug(mix->log, "copy STEREO to REAR");
if ((src_mask & _MASK(RL)) == 0) matrix[RL][FL] = 1.0f;
if ((src_mask & _MASK(RR)) == 0) matrix[RR][FR] = 1.0f;
if ((dst_mask & QUAD_STEREO) == QUAD_STEREO) {
spa_log_debug(mix->log, "copy STEREO to SIDES");
if ((src_mask & _MASK(SL)) == 0) matrix[SL][FL] = 1.0f;
if ((src_mask & _MASK(SR)) == 0) matrix[SR][FR] = 1.0f;
}
}
if (unassigned & STEREO){ if (unassigned & STEREO){
if (dst_mask & _MASK(FC)) { if (dst_mask & _MASK(FC)) {
spa_log_debug(mix->log, "assign STEREO to FC"); spa_log_debug(mix->log, "assign STEREO to FC");