aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample/rematrix.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-05-02 00:16:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-02 01:11:55 +0200
commit9b42653b22d43b89de96a00abe7fd61f9e048eb2 (patch)
tree584b378b634cfe19c8d0c3ec68a48447d0e7c011 /libswresample/rematrix.c
parent7bea0a064467ff845fb7ee494f83f5acf9f98cac (diff)
downloadffmpeg-9b42653b22d43b89de96a00abe7fd61f9e048eb2.tar.gz
swr: update side to back mixing.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r--libswresample/rematrix.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 27c4e1b2dc..7728445407 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -184,8 +184,15 @@ static int auto_matrix(SwrContext *s)
if(unaccounted & AV_CH_SIDE_LEFT){
if(s->out_ch_layout & AV_CH_BACK_LEFT){
- matrix[ BACK_LEFT][ SIDE_LEFT]+= 1.0;
- matrix[BACK_RIGHT][SIDE_RIGHT]+= 1.0;
+ /* if back channels do not exist in the input, just copy side
+ channels to back channels, otherwise mix side into back */
+ if (s->in_ch_layout & AV_CH_BACK_LEFT) {
+ matrix[BACK_LEFT ][SIDE_LEFT ] += M_SQRT1_2;
+ matrix[BACK_RIGHT][SIDE_RIGHT] += M_SQRT1_2;
+ } else {
+ matrix[BACK_LEFT ][SIDE_LEFT ] += 1.0;
+ matrix[BACK_RIGHT][SIDE_RIGHT] += 1.0;
+ }
}else if(s->out_ch_layout & AV_CH_BACK_CENTER){
matrix[BACK_CENTER][ SIDE_LEFT]+= M_SQRT1_2;
matrix[BACK_CENTER][SIDE_RIGHT]+= M_SQRT1_2;