aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mpc_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-30 08:44:28 +0100
committerMax Kellermann <max@duempel.org>2008-10-30 08:44:28 +0100
commit51348d699233d88852f824f3cf8b196fb149ee90 (patch)
tree4ef5cebbc5ef3e311cc48c6e11e9ad85638592f1 /src/decoder/mpc_plugin.c
parentecd485acbd3c450d467290f440eb34b025574393 (diff)
downloadmpd-51348d699233d88852f824f3cf8b196fb149ee90.tar.gz
mpd-51348d699233d88852f824f3cf8b196fb149ee90.tar.xz
mpd-51348d699233d88852f824f3cf8b196fb149ee90.zip
mpc: fix broken integer sample conversion
The conversion of integer samples was completely broken, which presumably didn't annoy anybody because libmpcdec provides float samples on most installations.
Diffstat (limited to 'src/decoder/mpc_plugin.c')
-rw-r--r--src/decoder/mpc_plugin.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index 0991913a4..0342794ec 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -74,12 +74,10 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
#ifdef MPC_FIXED_POINT
const int shift = 16 - MPC_FIXED_POINT_SCALE_SHIFT;
- if (sample > 0) {
- sample <<= shift;
- } else if (shift < 0) {
- sample >>= -shift;
- }
- val = sample;
+ if (shift < 0)
+ val = sample << -shift;
+ else
+ val = sample << shift;
#else
const int float_scale = 1 << (16 - 1);