comparison libmpcodecs/ad_msadpcm.c @ 6609:7745d73a5f20

bugfix by Keiki SATOH <kki@wakusei.ne.jp>
author arpi
date Sat, 29 Jun 2002 22:10:18 +0000
parents 8ae2bf330ad5
children 28677d779205
comparison
equal deleted inserted replaced
6608:da27a1bc1763 6609:7745d73a5f20
41 static int ms_adapt_coeff2[] = 41 static int ms_adapt_coeff2[] =
42 { 42 {
43 0, -256, 0, 64, 0, -208, -232 43 0, -256, 0, 64, 0, -208, -232
44 }; 44 };
45 45
46 #define MS_ADPCM_PREAMBLE_SIZE 7 46 #define MS_ADPCM_PREAMBLE_SIZE 6
47 47
48 #define LE_16(x) (le2me_16(*(unsigned short *)(x))) 48 #define LE_16(x) (le2me_16(*(unsigned short *)(x)))
49 #define LE_32(x) (le2me_32(*(unsigned int *)(x))) 49 #define LE_32(x) (le2me_32(*(unsigned int *)(x)))
50 50
51 // useful macros 51 // useful macros
157 sample2[1] = LE_16(&input[stream_ptr]); 157 sample2[1] = LE_16(&input[stream_ptr]);
158 stream_ptr += 2; 158 stream_ptr += 2;
159 SE_16BIT(sample2[1]); 159 SE_16BIT(sample2[1]);
160 } 160 }
161 161
162 if (channels == 1)
163 {
164 output[out_ptr++] = sample2[0];
165 output[out_ptr++] = sample1[0];
166 } else {
167 output[out_ptr++] = sample2[0];
168 output[out_ptr++] = sample2[1];
169 output[out_ptr++] = sample1[0];
170 output[out_ptr++] = sample1[1];
171 }
172
162 while (stream_ptr < block_size) 173 while (stream_ptr < block_size)
163 { 174 {
164 // get the next nibble 175 // get the next nibble
165 if (upper_nibble) 176 if (upper_nibble)
166 nibble = snibble = input[stream_ptr] >> 4; 177 nibble = snibble = input[stream_ptr] >> 4;