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