From b86a5d4303de09b22d6a81bdee6b3a02df38eb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 29 May 2008 12:17:16 +0000 Subject: [PATCH] gst/audioconvert/gstchannelmix.c: If mixing left or right to center (or the other way around) only take the complete ... Original commit message from CVS: * gst/audioconvert/gstchannelmix.c: (gst_channel_mix_fill_one_other): If mixing left or right to center (or the other way around) only take the complete value if we don't already have the original position in the source. --- ChangeLog | 8 ++++++++ gst/audioconvert/gstchannelmix.c | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 118f43160a..21daf682b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-29 Sebastian Dröge + + * gst/audioconvert/gstchannelmix.c: + (gst_channel_mix_fill_one_other): + If mixing left or right to center (or the other way around) only take + the complete value if we don't already have the original position in + the source. + 2008-05-29 Sebastian Dröge * gst-libs/gst/audio/multichannel.c: diff --git a/gst/audioconvert/gstchannelmix.c b/gst/audioconvert/gstchannelmix.c index 9f681c307b..0f9b945d2f 100644 --- a/gst/audioconvert/gstchannelmix.c +++ b/gst/audioconvert/gstchannelmix.c @@ -267,20 +267,30 @@ gst_channel_mix_fill_one_other (gfloat ** matrix, } /* src has left & dst has center => put into center */ - if (from_idx[0] != -1 && to_idx[1] != -1) { + if (from_idx[0] != -1 && to_idx[1] != -1 && from_idx[1] != -1) { + matrix[from_idx[0]][to_idx[1]] = 0.5 * ratio; + } else if (from_idx[0] != -1 && to_idx[1] != -1 && from_idx[1] == -1) { matrix[from_idx[0]][to_idx[1]] = ratio; } + /* src has right & dst has center => put into center */ - if (from_idx[2] != -1 && to_idx[1] != -1) { + if (from_idx[2] != -1 && to_idx[1] != -1 && from_idx[1] != -1) { + matrix[from_idx[2]][to_idx[1]] = 0.5 * ratio; + } else if (from_idx[2] != -1 && to_idx[1] != -1 && from_idx[1] == -1) { matrix[from_idx[2]][to_idx[1]] = ratio; } /* src has center & dst has left => passthrough */ - if (from_idx[1] != -1 && to_idx[0] != -1) { + if (from_idx[1] != -1 && to_idx[0] != -1 && from_idx[0] != -1) { + matrix[from_idx[1]][to_idx[0]] = 0.5 * ratio; + } else if (from_idx[1] != -1 && to_idx[0] != -1 && from_idx[0] == -1) { matrix[from_idx[1]][to_idx[0]] = ratio; } + /* src has center & dst has right => passthrough */ - if (from_idx[1] != -1 && to_idx[2] != -1) { + if (from_idx[1] != -1 && to_idx[2] != -1 && from_idx[2] != -1) { + matrix[from_idx[1]][to_idx[2]] = 0.5 * ratio; + } else if (from_idx[1] != -1 && to_idx[2] != -1 && from_idx[2] == -1) { matrix[from_idx[1]][to_idx[2]] = ratio; } }