diff options
author | Max Kellermann <max@duempel.org> | 2008-10-10 16:40:48 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-10 16:40:48 +0200 |
commit | f41fe1e0b5d86470fab406831c18d032e9835d84 (patch) | |
tree | 56ccf09864f8b8a491cb7c4aebc6cf967f928cff /src/inputPlugins | |
parent | bac136608d91999fdf366391be9633aa107c21f6 (diff) | |
download | mpd-f41fe1e0b5d86470fab406831c18d032e9835d84.tar.gz mpd-f41fe1e0b5d86470fab406831c18d032e9835d84.tar.xz mpd-f41fe1e0b5d86470fab406831c18d032e9835d84.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 1bfc707a5..13e4a4619 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -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); } |