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:
parent
bac136608d
commit
f41fe1e0b5
@ -116,14 +116,11 @@ static unsigned dither_buffer(int16_t *dest0, const struct mad_synth *synth,
|
|||||||
unsigned int num_channels)
|
unsigned int num_channels)
|
||||||
{
|
{
|
||||||
int16_t *dest = dest0;
|
int16_t *dest = dest0;
|
||||||
unsigned int i;
|
unsigned int i, c;
|
||||||
|
|
||||||
for (i = start; i < end; ++i) {
|
for (i = start; i < end; ++i) {
|
||||||
*dest++ = audio_linear_dither(synth->pcm.samples[0][i],
|
for (c = 0; c < num_channels; ++c)
|
||||||
dither);
|
*dest++ = audio_linear_dither(synth->pcm.samples[c][i],
|
||||||
|
|
||||||
if (num_channels == 2)
|
|
||||||
*dest++ = audio_linear_dither(synth->pcm.samples[1][i],
|
|
||||||
dither);
|
dither);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user