mp3: dither an arbitrary number of channels

The mp3 plugin did not use the MAD_NCHANNELS() value correctly: when a
stream was not stereo, it was assumed to be mono, although the correct
number was passed to MPD.  libmad doesn't support more than 2
channels, but this change allows gcc to optimize its inlining
strategy.
This commit is contained in:
Max Kellermann 2008-10-10 16:40:48 +02:00
parent bac136608d
commit f41fe1e0b5

View File

@ -116,14 +116,11 @@ static unsigned dither_buffer(int16_t *dest0, const struct mad_synth *synth,
unsigned int num_channels)
{
int16_t *dest = dest0;
unsigned int i;
unsigned int i, c;
for (i = start; i < end; ++i) {
*dest++ = audio_linear_dither(synth->pcm.samples[0][i],
dither);
if (num_channels == 2)
*dest++ = audio_linear_dither(synth->pcm.samples[1][i],
for (c = 0; c < num_channels; ++c)
*dest++ = audio_linear_dither(synth->pcm.samples[c][i],
dither);
}