summaryrefslogtreecommitdiff
path: root/libavcodec/ws-snd1.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-12 10:22:31 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-09-26 16:23:15 -0400
commit659c719bc77569ea3a109223dcc513255611a7ce (patch)
tree49d38427a07d830e49feca8e38d0b60714b32923 /libavcodec/ws-snd1.c
parent618b067d2132b0336e609bc311e85c557ffb30ed (diff)
ws_snd: remove the 2-bit ADPCM table and just subtract 2 instead.
Diffstat (limited to 'libavcodec/ws-snd1.c')
-rw-r--r--libavcodec/ws-snd1.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c
index 57902a8243..b310461e08 100644
--- a/libavcodec/ws-snd1.c
+++ b/libavcodec/ws-snd1.c
@@ -32,7 +32,6 @@
* http://www.multimedia.cx
*/
-static const int8_t ws_adpcm_2bit[] = { -2, -1, 0, 1};
static const int8_t ws_adpcm_4bit[] = {
-9, -8, -6, -5, -4, -3, -2, -1,
0, 1, 2, 3, 4, 5, 6, 8 };
@@ -117,16 +116,16 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
case 0: /* ADPCM 2-bit */
for (count++; count > 0; count--) {
code = *buf++;
- sample += ws_adpcm_2bit[code & 0x3];
+ sample += ( code & 0x3) - 2;
sample = av_clip_uint8(sample);
*samples++ = sample;
- sample += ws_adpcm_2bit[(code >> 2) & 0x3];
+ sample += ((code >> 2) & 0x3) - 2;
sample = av_clip_uint8(sample);
*samples++ = sample;
- sample += ws_adpcm_2bit[(code >> 4) & 0x3];
+ sample += ((code >> 4) & 0x3) - 2;
sample = av_clip_uint8(sample);
*samples++ = sample;
- sample += ws_adpcm_2bit[(code >> 6) & 0x3];
+ sample += (code >> 6) - 2;
sample = av_clip_uint8(sample);
*samples++ = sample;
}