Commit 7653ab43 authored by Max Kellermann's avatar Max Kellermann

mp3: audio_linear_dither() returns mpd_sint16

The return value of audio_linear_dither() is always casted to mpd_sint16. Returning long does not make sense, and consumed 8 bytes on a 64 bit platform.
parent 9c823d67
...@@ -60,7 +60,7 @@ static unsigned long prng(unsigned long state) ...@@ -60,7 +60,7 @@ static unsigned long prng(unsigned long state)
return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL; return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL;
} }
static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample, static mpd_sint16 audio_linear_dither(unsigned int bits, mad_fixed_t sample,
struct audio_dither *dither) struct audio_dither *dither)
{ {
unsigned int scalebits; unsigned int scalebits;
...@@ -102,7 +102,7 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample, ...@@ -102,7 +102,7 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample,
dither->error[0] = sample - output; dither->error[0] = sample - output;
return output >> scalebits; return (mpd_sint16)(output >> scalebits);
} }
static unsigned dither_buffer(mpd_sint16 *dest0, const struct mad_synth *synth, static unsigned dither_buffer(mpd_sint16 *dest0, const struct mad_synth *synth,
...@@ -114,14 +114,12 @@ static unsigned dither_buffer(mpd_sint16 *dest0, const struct mad_synth *synth, ...@@ -114,14 +114,12 @@ static unsigned dither_buffer(mpd_sint16 *dest0, const struct mad_synth *synth,
unsigned int i; unsigned int i;
for (i = start; i < end; ++i) { for (i = start; i < end; ++i) {
*dest++ = (mpd_sint16) *dest++ = audio_linear_dither(16,
audio_linear_dither(16,
synth->pcm.samples[0][i], synth->pcm.samples[0][i],
dither); dither);
if (num_channels == 2) if (num_channels == 2)
*dest++ = (mpd_sint16) *dest++ = audio_linear_dither(16,
audio_linear_dither(16,
synth->pcm.samples[1][i], synth->pcm.samples[1][i],
dither); dither);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment