summaryrefslogtreecommitdiff
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-09-28 20:27:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-09-28 20:27:56 +0000
commitcd1f22f97e9cec9a64c41f33dfd9658c73461270 (patch)
tree2db063b025005cab46a834406b582a8ab80b6117 /libavcodec/pcm.c
parent6eb23b82c2b61e0e4f09d7ecdf1e7dda287cc81a (diff)
simpler
Originally committed as revision 2310 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 7f3d630f08..a6c0d343b0 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -45,19 +45,11 @@ static int alaw2linear(unsigned char a_val)
a_val ^= 0x55;
- t = (a_val & QUANT_MASK) << 4;
+ t = a_val & QUANT_MASK;
seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
- switch (seg) {
- case 0:
- t += 8;
- break;
- case 1:
- t += 0x108;
- break;
- default:
- t += 0x108;
- t <<= seg - 1;
- }
+ if(seg) t= (t + t + 1 + 32) << (seg + 2);
+ else t= (t + t + 1 ) << 3;
+
return ((a_val & SIGN_BIT) ? t : -t);
}