annotate adpcm.c @ 5543:c75f75806af1

memcpy must return destination ptr patch by Adam <adam@cfar.umd.edu>
author michael
date Wed, 10 Apr 2002 05:23:13 +0000
parents f9cd6381e327
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
1 /*
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
2 Unified ADPCM Decoder for MPlayer
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
3
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
4 This file is in charge of decoding all of the various ADPCM data
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
5 formats that various entities have created. Details about the data
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
6 formats can be found here:
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
7 http://www.pcisys.net/~melanson/codecs/
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
8
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
9 (C) 2001 Mike Melanson
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
10 */
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
11
5408
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
12 #if 0
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
13 #include "config.h"
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
14 #include "bswap.h"
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
15 #include "adpcm.h"
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
16 #include "mp_msg.h"
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
17
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
18 #define BE_16(x) (be2me_16(*(unsigned short *)(x)))
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
19 #define BE_32(x) (be2me_32(*(unsigned int *)(x)))
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
20 #define LE_16(x) (le2me_16(*(unsigned short *)(x)))
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
21 #define LE_32(x) (le2me_32(*(unsigned int *)(x)))
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
22
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
23 // pertinent tables
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
24 static int adpcm_step[89] =
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
25 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
26 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
27 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
28 50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
29 130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
30 337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
31 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
32 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
33 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
34 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
35 };
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
36
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
37 static int adpcm_index[16] =
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
38 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
39 -1, -1, -1, -1, 2, 4, 6, 8,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
40 -1, -1, -1, -1, 2, 4, 6, 8
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
41 };
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
42
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
43 static int ms_adapt_table[] =
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
44 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
45 230, 230, 230, 230, 307, 409, 512, 614,
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
46 768, 614, 512, 409, 307, 230, 230, 230
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
47 };
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
48
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
49 static int ms_adapt_coeff1[] =
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
50 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
51 256, 512, 0, 192, 240, 460, 392
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
52 };
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
53
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
54 static int ms_adapt_coeff2[] =
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
55 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
56 0, -256, 0, 64, 0, -208, -232
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
57 };
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
58
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
59 // useful macros
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
60 // clamp a number between 0 and 88
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
61 #define CLAMP_0_TO_88(x) if (x < 0) x = 0; else if (x > 88) x = 88;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
62 // clamp a number within a signed 16-bit range
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
63 #define CLAMP_S16(x) if (x < -32768) x = -32768; \
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
64 else if (x > 32767) x = 32767;
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
65 // clamp a number above 16
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
66 #define CLAMP_ABOVE_16(x) if (x < 16) x = 16;
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
67 // sign extend a 16-bit value
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
68 #define SE_16BIT(x) if (x & 0x8000) x -= 0x10000;
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
69 // sign extend a 4-bit value
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
70 #define SE_4BIT(x) if (x & 0x8) x -= 0x10;
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
71
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
72 void decode_nibbles(unsigned short *output,
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
73 int output_size, int channels,
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
74 int predictor_l, int index_l,
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
75 int predictor_r, int index_r)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
76 {
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
77 int step[2];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
78 int predictor[2];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
79 int index[2];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
80 int diff;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
81 int i;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
82 int sign;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
83 int delta;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
84 int channel_number = 0;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
85
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
86 step[0] = adpcm_step[index_l];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
87 step[1] = adpcm_step[index_r];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
88 predictor[0] = predictor_l;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
89 predictor[1] = predictor_r;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
90 index[0] = index_l;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
91 index[1] = index_r;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
92
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
93 for (i = 0; i < output_size; i++)
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
94 {
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
95 delta = output[i];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
96
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
97 index[channel_number] += adpcm_index[delta];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
98 CLAMP_0_TO_88(index[channel_number]);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
99
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
100 sign = delta & 8;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
101 delta = delta & 7;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
102
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
103 diff = step[channel_number] >> 3;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
104 if (delta & 4) diff += step[channel_number];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
105 if (delta & 2) diff += step[channel_number] >> 1;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
106 if (delta & 1) diff += step[channel_number] >> 2;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
107
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
108 if (sign)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
109 predictor[channel_number] -= diff;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
110 else
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
111 predictor[channel_number] += diff;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
112
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
113 CLAMP_S16(predictor[channel_number]);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
114 output[i] = predictor[channel_number];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
115 step[channel_number] = adpcm_step[index[channel_number]];
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
116
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
117 // toggle channel
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
118 channel_number ^= channels - 1;
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
119
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
120 }
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
121 }
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
122
5408
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
123 int qt_ima_adpcm_decode_block(unsigned short *output, unsigned char *input,
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
124 int channels)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
125 {
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
126 int initial_predictor_l = 0;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
127 int initial_predictor_r = 0;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
128 int initial_index_l = 0;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
129 int initial_index_r = 0;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
130 int i;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
131
3763
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
132 initial_predictor_l = BE_16(&input[0]);
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
133 initial_index_l = initial_predictor_l;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
134
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
135 // mask, sign-extend, and clamp the predictor portion
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
136 initial_predictor_l &= 0xFF80;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
137 SE_16BIT(initial_predictor_l);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
138 CLAMP_S16(initial_predictor_l);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
139
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
140 // mask and clamp the index portion
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
141 initial_index_l &= 0x7F;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
142 CLAMP_0_TO_88(initial_index_l);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
143
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
144 // handle stereo
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
145 if (channels > 1)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
146 {
3763
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
147 initial_predictor_r = BE_16(&input[IMA_ADPCM_BLOCK_SIZE]);
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
148 initial_index_r = initial_predictor_r;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
149
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
150 // mask, sign-extend, and clamp the predictor portion
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
151 initial_predictor_r &= 0xFF80;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
152 SE_16BIT(initial_predictor_r);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
153 CLAMP_S16(initial_predictor_r);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
154
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
155 // mask and clamp the index portion
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
156 initial_index_r &= 0x7F;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
157 CLAMP_0_TO_88(initial_index_r);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
158 }
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
159
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
160 // break apart all of the nibbles in the block
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
161 if (channels == 1)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
162 for (i = 0; i < IMA_ADPCM_SAMPLES_PER_BLOCK / 2; i++)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
163 {
3763
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
164 output[i * 2 + 0] = input[2 + i] & 0x0F;
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
165 output[i * 2 + 1] = input[2 + i] >> 4;
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
166 }
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
167 else
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
168 for (i = 0; i < IMA_ADPCM_SAMPLES_PER_BLOCK / 2 * 2; i++)
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
169 {
3763
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
170 output[i * 4 + 0] = input[2 + i] & 0x0F;
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
171 output[i * 4 + 1] = input[2 + IMA_ADPCM_BLOCK_SIZE + i] & 0x0F;
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
172 output[i * 4 + 2] = input[2 + i] >> 4;
81d84039dd17 fixed stereo IMA4 decoding
melanson
parents: 3756
diff changeset
173 output[i * 4 + 3] = input[2 + IMA_ADPCM_BLOCK_SIZE + i] >> 4;
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
174 }
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
175
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
176 decode_nibbles(output,
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
177 IMA_ADPCM_SAMPLES_PER_BLOCK * channels, channels,
3756
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
178 initial_predictor_l, initial_index_l,
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
179 initial_predictor_r, initial_index_r);
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
180
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
181 return IMA_ADPCM_SAMPLES_PER_BLOCK * channels;
734d0c0a8ab0 Initial support for unified ADPCM decoder
melanson
parents:
diff changeset
182 }
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
183
5408
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
184 int ms_ima_adpcm_decode_block(unsigned short *output, unsigned char *input,
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
185 int channels, int block_size)
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
186 {
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
187 int initial_predictor_l = 0;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
188 int initial_predictor_r = 0;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
189 int initial_index_l = 0;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
190 int initial_index_r = 0;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
191 int i;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
192
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
193 initial_predictor_l = BE_16(&input[0]);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
194 initial_index_l = initial_predictor_l;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
195
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
196 // mask, sign-extend, and clamp the predictor portion
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
197 initial_predictor_l &= 0xFF80;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
198 SE_16BIT(initial_predictor_l);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
199 CLAMP_S16(initial_predictor_l);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
200
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
201 // mask and clamp the index portion
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
202 initial_index_l &= 0x7F;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
203 CLAMP_0_TO_88(initial_index_l);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
204
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
205 // handle stereo
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
206 if (channels > 1)
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
207 {
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
208 initial_predictor_r = BE_16(&input[IMA_ADPCM_BLOCK_SIZE]);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
209 initial_index_r = initial_predictor_r;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
210
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
211 // mask, sign-extend, and clamp the predictor portion
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
212 initial_predictor_r &= 0xFF80;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
213 SE_16BIT(initial_predictor_r);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
214 CLAMP_S16(initial_predictor_r);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
215
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
216 // mask and clamp the index portion
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
217 initial_index_r &= 0x7F;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
218 CLAMP_0_TO_88(initial_index_r);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
219 }
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
220
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
221 // break apart all of the nibbles in the block
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
222 if (channels == 1)
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
223 for (i = 0; i < IMA_ADPCM_SAMPLES_PER_BLOCK / 2; i++)
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
224 {
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
225 output[i * 2 + 0] = input[2 + i] & 0x0F;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
226 output[i * 2 + 1] = input[2 + i] >> 4;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
227 }
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
228 else
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
229 for (i = 0; i < IMA_ADPCM_SAMPLES_PER_BLOCK / 2 * 2; i++)
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
230 {
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
231 output[i * 4 + 0] = input[2 + i] & 0x0F;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
232 output[i * 4 + 1] = input[2 + IMA_ADPCM_BLOCK_SIZE + i] & 0x0F;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
233 output[i * 4 + 2] = input[2 + i] >> 4;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
234 output[i * 4 + 3] = input[2 + IMA_ADPCM_BLOCK_SIZE + i] >> 4;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
235 }
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
236
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
237 decode_nibbles(output,
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
238 IMA_ADPCM_SAMPLES_PER_BLOCK * channels, channels,
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
239 initial_predictor_l, initial_index_l,
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
240 initial_predictor_r, initial_index_r);
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
241
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
242 return IMA_ADPCM_SAMPLES_PER_BLOCK * channels;
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
243 }
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
244
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
245 int ms_adpcm_decode_block(unsigned short *output, unsigned char *input,
3875
e3caff2daa98 fixed stereo MS ADPCM decoder and reinstated opensource decoder as the
melanson
parents: 3826
diff changeset
246 int channels, int block_size)
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
247 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
248 int current_channel = 0;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
249 int idelta[2];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
250 int sample1[2];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
251 int sample2[2];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
252 int coeff1[2];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
253 int coeff2[2];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
254 int stream_ptr = 0;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
255 int out_ptr = 0;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
256 int upper_nibble = 1;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
257 int nibble;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
258 int snibble; // signed nibble
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
259 int predictor;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
260
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
261 // fetch the header information, in stereo if both channels are present
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
262 if (input[stream_ptr] > 6)
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
263 mp_msg(MSGT_DECAUDIO, MSGL_WARN,
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
264 "MS ADPCM: coefficient (%d) out of range (should be [0..6])\n",
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
265 input[stream_ptr]);
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
266 coeff1[0] = ms_adapt_coeff1[input[stream_ptr]];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
267 coeff2[0] = ms_adapt_coeff2[input[stream_ptr]];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
268 stream_ptr++;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
269 if (channels == 2)
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
270 {
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
271 if (input[stream_ptr] > 6)
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
272 mp_msg(MSGT_DECAUDIO, MSGL_WARN,
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
273 "MS ADPCM: coefficient (%d) out of range (should be [0..6])\n",
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
274 input[stream_ptr]);
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
275 coeff1[1] = ms_adapt_coeff1[input[stream_ptr]];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
276 coeff2[1] = ms_adapt_coeff2[input[stream_ptr]];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
277 stream_ptr++;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
278 }
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
279
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
280 idelta[0] = LE_16(&input[stream_ptr]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
281 stream_ptr += 2;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
282 SE_16BIT(idelta[0]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
283 if (channels == 2)
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
284 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
285 idelta[1] = LE_16(&input[stream_ptr]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
286 stream_ptr += 2;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
287 SE_16BIT(idelta[1]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
288 }
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
289
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
290 sample1[0] = LE_16(&input[stream_ptr]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
291 stream_ptr += 2;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
292 SE_16BIT(sample1[0]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
293 if (channels == 2)
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
294 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
295 sample1[1] = LE_16(&input[stream_ptr]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
296 stream_ptr += 2;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
297 SE_16BIT(sample1[1]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
298 }
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
299
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
300 sample2[0] = LE_16(&input[stream_ptr]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
301 stream_ptr += 2;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
302 SE_16BIT(sample2[0]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
303 if (channels == 2)
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
304 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
305 sample2[1] = LE_16(&input[stream_ptr]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
306 stream_ptr += 2;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
307 SE_16BIT(sample2[1]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
308 }
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
309
3875
e3caff2daa98 fixed stereo MS ADPCM decoder and reinstated opensource decoder as the
melanson
parents: 3826
diff changeset
310 while (stream_ptr < block_size)
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
311 {
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
312 // get the next nibble
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
313 if (upper_nibble)
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
314 nibble = snibble = input[stream_ptr] >> 4;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
315 else
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
316 nibble = snibble = input[stream_ptr++] & 0x0F;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
317 upper_nibble ^= 1;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
318 SE_4BIT(snibble);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
319
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
320 predictor = (
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
321 ((sample1[current_channel] * coeff1[current_channel]) +
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
322 (sample2[current_channel] * coeff2[current_channel])) / 256) +
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
323 (snibble * idelta[current_channel]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
324 CLAMP_S16(predictor);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
325 sample2[current_channel] = sample1[current_channel];
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
326 sample1[current_channel] = predictor;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
327 output[out_ptr++] = predictor;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
328
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
329 // compute the next adaptive scale factor (a.k.a. the variable idelta)
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
330 idelta[current_channel] =
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
331 (ms_adapt_table[nibble] * idelta[current_channel]) / 256;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
332 CLAMP_ABOVE_16(idelta[current_channel]);
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
333
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
334 // toggle the channel
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
335 current_channel ^= channels - 1;
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
336 }
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
337
3875
e3caff2daa98 fixed stereo MS ADPCM decoder and reinstated opensource decoder as the
melanson
parents: 3826
diff changeset
338 return (block_size - (MS_ADPCM_PREAMBLE_SIZE * channels)) * 2;
3787
55603340d1b2 implemented open source MS ADPCM decoder
melanson
parents: 3763
diff changeset
339 }
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
340
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
341 int dk4_adpcm_decode_block(unsigned short *output, unsigned char *input,
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
342 int channels, int block_size)
3933
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
343 {
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
344 int i;
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
345 int output_ptr;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
346 int predictor_l = 0;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
347 int predictor_r = 0;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
348 int index_l = 0;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
349 int index_r = 0;
3933
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
350
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
351 // the first predictor value goes straight to the output
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
352 predictor_l = output[0] = LE_16(&input[0]);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
353 SE_16BIT(predictor_l);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
354 index_l = input[2];
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
355 if (channels == 2)
3933
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
356 {
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
357 predictor_r = output[1] = LE_16(&input[4]);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
358 SE_16BIT(predictor_r);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
359 index_r = input[6];
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
360 }
3933
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
361
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
362 output_ptr = channels;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
363 for (i = DK4_ADPCM_PREAMBLE_SIZE * channels; i < block_size; i++)
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
364 {
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
365 output[output_ptr++] = input[i] >> 4;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
366 output[output_ptr++] = input[i] & 0x0F;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
367 }
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
368
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
369 decode_nibbles(&output[channels],
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
370 (block_size - DK4_ADPCM_PREAMBLE_SIZE * channels) * 2 - channels,
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
371 channels,
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
372 predictor_l, index_l,
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
373 predictor_r, index_r);
3933
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
374
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
375 return (block_size - DK4_ADPCM_PREAMBLE_SIZE * channels) * 2 - channels;
3933
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
376 }
60db4273246d added initial support for format 0x61 ADPCM (sounds good, but still pops)
melanson
parents: 3875
diff changeset
377
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
378 #define DK3_GET_NEXT_NIBBLE() \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
379 if (decode_top_nibble_next) \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
380 { \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
381 nibble = (last_byte >> 4) & 0x0F; \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
382 decode_top_nibble_next = 0; \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
383 } \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
384 else \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
385 { \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
386 last_byte = input[in_ptr++]; \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
387 nibble = last_byte & 0x0F; \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
388 decode_top_nibble_next = 1; \
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
389 }
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
390
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
391 // note: This decoder assumes the format 0x62 data always comes in
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
392 // stereo flavor
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
393 int dk3_adpcm_decode_block(unsigned short *output, unsigned char *input)
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
394 {
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
395 int sum_pred;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
396 int diff_pred;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
397 int sum_index;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
398 int diff_index;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
399 int diff_channel;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
400 int in_ptr = 0x10;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
401 int out_ptr = 0;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
402
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
403 unsigned char last_byte = 0;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
404 unsigned char nibble;
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
405 int decode_top_nibble_next = 0;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
406
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
407 // ADPCM work variables
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
408 int sign;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
409 int delta;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
410 int step;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
411 int diff;
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
412
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
413 sum_pred = LE_16(&input[10]);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
414 diff_pred = LE_16(&input[12]);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
415 SE_16BIT(sum_pred);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
416 SE_16BIT(diff_pred);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
417 diff_channel = diff_pred;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
418 sum_index = input[14];
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
419 diff_index = input[15];
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
420
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
421 while (in_ptr < 2048)
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
422 {
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
423 // process the first predictor of the sum channel
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
424 DK3_GET_NEXT_NIBBLE();
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
425
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
426 step = adpcm_step[sum_index];
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
427
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
428 sign = nibble & 8;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
429 delta = nibble & 7;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
430
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
431 diff = step >> 3;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
432 if (delta & 4) diff += step;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
433 if (delta & 2) diff += step >> 1;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
434 if (delta & 1) diff += step >> 2;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
435
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
436 if (sign)
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
437 sum_pred -= diff;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
438 else
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
439 sum_pred += diff;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
440
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
441 CLAMP_S16(sum_pred);
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
442
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
443 sum_index += adpcm_index[nibble];
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
444 CLAMP_0_TO_88(sum_index);
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
445
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
446 // process the diff channel predictor
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
447 DK3_GET_NEXT_NIBBLE();
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
448
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
449 step = adpcm_step[diff_index];
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
450
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
451 sign = nibble & 8;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
452 delta = nibble & 7;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
453
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
454 diff = step >> 3;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
455 if (delta & 4) diff += step;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
456 if (delta & 2) diff += step >> 1;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
457 if (delta & 1) diff += step >> 2;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
458
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
459 if (sign)
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
460 diff_pred -= diff;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
461 else
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
462 diff_pred += diff;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
463
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
464 CLAMP_S16(diff_pred);
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
465
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
466 diff_index += adpcm_index[nibble];
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
467 CLAMP_0_TO_88(diff_index);
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
468
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
469 // output the first pair of stereo PCM samples
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
470 diff_channel = (diff_channel + diff_pred) / 2;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
471 output[out_ptr++] = sum_pred + diff_channel;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
472 output[out_ptr++] = sum_pred - diff_channel;
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
473
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
474 // process the second predictor of the sum channel
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
475 DK3_GET_NEXT_NIBBLE();
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
476
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
477 step = adpcm_step[sum_index];
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
478
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
479 sign = nibble & 8;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
480 delta = nibble & 7;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
481
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
482 diff = step >> 3;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
483 if (delta & 4) diff += step;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
484 if (delta & 2) diff += step >> 1;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
485 if (delta & 1) diff += step >> 2;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
486
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
487 if (sign)
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
488 sum_pred -= diff;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
489 else
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
490 sum_pred += diff;
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
491
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
492 CLAMP_S16(sum_pred);
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
493
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
494 sum_index += adpcm_index[nibble];
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
495 CLAMP_0_TO_88(sum_index);
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
496
4854
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
497 // output the second pair of stereo PCM samples
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
498 output[out_ptr++] = sum_pred + diff_channel;
4a6dde59834c fixed, strengthened, rewrote, and renamed a variety of the ADPCM decoders
melanson
parents: 4001
diff changeset
499 output[out_ptr++] = sum_pred - diff_channel;
3826
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
500 }
8a88ed2473aa added initial, not-yet-functional, support for fox62 audio
melanson
parents: 3787
diff changeset
501
4001
ae6f97724b84 fixed format 0x62 ADPCM audio
melanson
parents: 3939
diff changeset
502 return out_ptr;
3939
6b31db273596 fixed FOX61 ADPCM; still working on FOX62
melanson
parents: 3933
diff changeset
503 }
5408
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
504 #endif
f9cd6381e327 reworked ADPCM decoders; changes include:
melanson
parents: 4854
diff changeset
505