1 /*
2 ** Copyright (C) 2007-2018 Erik de Castro Lopo <erikd@mega-nerd.com>
3 ** Copyright (C) 2017-2018 Arthur Taylor <art@ified.ca>
4 **
5 ** This library is free software; you can redistribute it and/or modify it
6 ** under the terms of the GNU Lesser General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or (at
8 ** your option) any later version.
9 **
10 ** This library is distributed in the hope that it will be useful, but
11 ** WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
13 ** General Public License for more details.
14 **
15 ** You should have received a copy of the GNU Lesser General Public License
16 ** along with this library. If not, write to the Free Software Foundation,
17 ** Fifth Floor, 51 Franklin Street, Boston, MA 02111-1301, USA.
18 */
19
20 #include "sfconfig.h"
21
22 #include <stdio.h>
23
24 #include "test_main.h"
25
26 #include "nms_adpcm.c"
27
28 static const short pcm_data_src [] =
29 { 505, 743, 805, 409, 101, -552, -709, -679,
30 -624, -1174, -1050, 32, -401, -769, -679, 47,
31 -3273, -4425, -2158, -176, 824, 1057, 1245, 805,
32 2414, 3282, 1739, -624, -1197, -1663, -913, 603,
33 549, -614, 707, 3314, 2864, 1127, -294, -919,
34 -1251, -147, 30, -750, -131, 1394, 2197, 1829,
35 1387, 417, 391, 533, 581, 179, -210, -210,
36 -884, -937, -1373, -1338, -1811, -2727, -2536, -1552,
37 -651, -3556, -7713, -9083, -6182, 1070, 4983, 5341,
38 4596, 4682, 6488, 5197, 2401, -2702, -5261, -4036,
39 -1995, 463, 1056, 2436, 3238, 4395, 4478, 1130,
40 -2383, -4349, -4547, -3631, -1396, 1029, 2589, 3948,
41 4966, 4312, 2362, 492, -1289, -2259, -1659, -597,
42 239, 1433, 2353, 2512, 1763, 610, -291, -640,
43 7, 132, 432, 438, -1070, -1202, -1071, -1841,
44 -462, 225, -4465, -11313, -10492, -4522, -2096, -7013,
45 -11770, -2546, 7687, 12765, 12014, 5324, 1645, 1191,
46 3800, -187, -6689, -7778, -4631, 2487, 7352, 7928,
47 4317, 2424, 3784, 2301, -1713, -6668, -8345, -6453,
48 -2303, 2269, 3232, 4114, 5054, 5054, 3768, 1060,
49 -1793, -3302, -2059, -86, 1153, 1690, 2869, 3841,
50 3551, 1919, -197, -1391, -847, 128, 746, 1111,
51 431, 559, 1086, 138, -1539, -2758, -1886, 1351,
52 2407, -1883, -8356, -10999, -9917, -7329, -4295, -3209,
53 -11616, -15352, 1032, 12603, 13233, 9059, 4019, 1858,
54 3368, 7454, -56, -8600, -7278, -818, 5478, 7039,
55 5630, 1186, 1634, 5422, 2518, -3182, -8271, -7889,
56 -4399, -129, 3205, 2933, 3661, 5886, 6543, 3798,
57 374, -2722, -3378, -1804, -24, 385, 1663, 3595,
58 4749, 3865, 1402, -851, -1932, -1394, -725, -219,
59 290, 658, 1074, 1638, 536, 204, -340, 408,
60 1835, 1261, -2872, -4840, -5978, -8177, -7644, -6554,
61 -8093, -6174, -7796, -17019, -12355, 1280, 12576, 11868,
62 10710, 8578, 5605, 9675, 7123, -977, -8770, -6740,
63 -1327, 2905, 6386, 5026, 3809, 5137, 6392, 2463,
64 -4924, -8830, -9572, -6122, -1608, 1677, 3379, 5660,
65 8236, 7225, 4470, 295, -2628, -3572, -2107, -666,
66 951, 3101, 5049, 4759, 2367, -140, -2078, -2471,
67 -2332, -1547, -798, 410, 1825, 3329, 3092, 352,
68 -3310, -3307, -1229, -415, 532, 2091, 465, -1430
69 } ;
70
71 /* pcm_data encoded as 16kbs from a known reference */
72 static const unsigned short test_codes_16 [] =
73 { 0x5777, 0xfff0, 0xdcd0, 0x672d, 0x1826, 0xc11c, 0x0822, 0xffee,
74 0x3ddc, 0x6372, 0x0116, 0xc8d8, 0x6780, 0x8624, 0x3323, 0x33ef,
75 0xd865, 0x4cd8, 0x3372, 0x1096, 0x0049, 0xa911, 0x1288, 0xa74d,
76 0x3fee, 0xcc45, 0x52de, 0x6a72, 0x9118, 0xe291, 0x60a2, 0x3164,
77 0x73fe, 0xeddf, 0x57b5, 0x185a, 0xe889, 0x460e, 0x2646, 0x8d87,
78 0xe5ba, 0x004c
79 } ;
80
81 /* pcm_data encoded as 24kbs from a known reference */
82 static const unsigned short test_codes_24 [] =
83 { 0x7776, 0x2fec, 0xceb0, 0xffd0, 0x3241, 0x650a, 0x0a26, 0x61ba,
84 0xa10b, 0x3912, 0x39a8, 0xebfa, 0x1fff, 0x8552, 0x2342, 0x0204,
85 0x454b, 0xccbb, 0x4318, 0xaa00, 0x1642, 0x3031, 0xfc8f, 0x38ff,
86 0xf604, 0x4924, 0x2ddb, 0x0469, 0xbcaa, 0x83b6, 0x0049, 0x8828,
87 0x2266, 0x3801, 0x873d, 0xcb86, 0x0eff, 0xef64, 0xd402, 0x44fa,
88 0x2867, 0xd1d0, 0xa109, 0x2a11, 0x8a64, 0x4018, 0x1357, 0xd5a5,
89 0x4bfc, 0xcbfe, 0x070a, 0x6307, 0x1858, 0x624b, 0xf9a9, 0x783b,
90 0x0880, 0x1652, 0xc893, 0x641c, 0xf30d, 0x004c
91 } ;
92
93 /* pcm_data encoded as 32kbs from a known reference */
94 static const unsigned short test_codes_32 [] =
95 { 0x7772, 0x0cdc, 0xbec2, 0xacb2, 0xff90, 0x1220, 0x551c, 0xcc84,
96 0x2c47, 0x30aa, 0xa10b, 0x0663, 0x2812, 0x28a9, 0xf9ba, 0xceb9,
97 0x1fec, 0x9553, 0x2361, 0x9ed8, 0x8314, 0x564b, 0xddba, 0x1346,
98 0x6308, 0xab00, 0x0721, 0x2908, 0x3820, 0xf89c, 0x38ff, 0xa2bf,
99 0xc535, 0x2933, 0x5de9, 0x8633, 0x8569, 0xbeca, 0x1186, 0x5528,
100 0xd000, 0xaa21, 0x0473, 0x2800, 0x1112, 0xa64d, 0xdc17, 0x8eeb,
101 0xccac, 0xfe74, 0xc501, 0x63f9, 0x2040, 0x3a73, 0xc9b9, 0x9188,
102 0x7318, 0x0a81, 0x9a65, 0x5188, 0x00ba, 0x2256, 0xd5b6, 0x4bfa,
103 0xbeac, 0xe8fe, 0x343b, 0x7117, 0x9ca4, 0x915a, 0x563d, 0xcad0,
104 0xa837, 0x302a, 0x1a2a, 0x3561, 0x98a9, 0xb9b5, 0x578a, 0xc48b,
105 0x25f0, 0x1000
106 } ;
107
108
109 /* test_codes_16 decoded by a known reference */
110 const short pcm_data_out16 [] =
111 { 12, 16, 24, 36, 52, -68, -104, -156,
112 -224, -309, -433, 12, -449, -618, -851, 32,
113 -871, -1176, -1586, 60, 1172, 634, 1566, 983,
114 1995, 2586, 1718, -1152, -815, -2313, -1610, 1261,
115 1056, -253, 522, 1799, 2506, 1518, 72, -329,
116 -1510, -76, 337, -1144, 68, 1369, 2200, 1337,
117 1016, 60, 405, 461, 433, 389, -36, -164,
118 -550, -871, -1212, -1626, -2136, -2791, -2064, -1642,
119 -485, -1566, -2538, -3445, -4481, 650, 4381, 3799,
120 5807, 4742, 6674, 5590, 2072, -2228, -5650, -4983,
121 -1698, 441, 1333, 3064, 2855, 3815, 5108, 2156,
122 -2228, -3321, -5028, -4405, -1550, 771, 3232, 3273,
123 4008, 5008, 2024, 859, -654, -2746, -1694, -136,
124 68, 1409, 1759, 2453, 2016, 522, -514, -445,
125 0, 305, 493, 518, -232, -1076, -1116, -1321,
126 -506, 365, -140, -1132, -2076, -2895, -2357, -2477,
127 -3325, -2859, 666, 4449, 7164, 6244, 1847, 1365,
128 3827, -779, -7682, -8951, -3811, 1718, 6566, 7120,
129 4674, 1959, 1819, 2032, -1104, -5220, -8518, -7626,
130 -2385, 2714, 3510, 3871, 4831, 4024, 4156, 1590,
131 -1694, -3437, -2393, 96, 959, 1847, 2775, 3638,
132 3072, 1734, -204, -1730, -718, -92, 453, 807,
133 220, 514, 1349, -40, -1285, -2477, -1566, 1273,
134 2586, 546, -2887, -5534, -6883, -7461, -5281, -2224,
135 -2361, -5104, -48, 9228, 12140, 9048, 3614, 1927,
136 4618, 6004, -148, -9871, -5582, -489, 6835, 6746,
137 6839, 2851, 3028, 4566, 1461, -2028, -6883, -7642,
138 -5321, -610, 3385, 3461, 3088, 3389, 4570, 4321,
139 -389, -2630, -3369, -1706, -136, 220, 1594, 3024,
140 4622, 4232, 1265, -943, -2273, -1638, -726, -232,
141 365, 538, 995, 1530, 289, 453, -68, 12,
142 1184, 1562, 92, -2558, -4859, -6277, -7096, -5461,
143 -4811, -6020, -8851, -12594, -11501, -943, 12927, 10449,
144 8935, 10389, 5662, 5755, 9108, 1827, -10224, -7807,
145 -148, 3429, 7722, 5212, 4734, 3847, 5570, 3433,
146 -3931, -8244, -8461, -5397, -1710, 1919, 3787, 4558,
147 5040, 5722, 4811, -441, -3140, -4180, -2397, -493,
148 1309, 3064, 4116, 5040, 2759, -730, -2445, -2847,
149 -2080, -1682, -1124, 706, 2032, 3325, 3248, 425,
150 -3586, -2987, -1397, -188, 144, 1506, 4, -2028
151 } ;
152
153 /* test_codes_24 decoded by a known reference */
154 static const short pcm_data_out24 [] =
155 { 16, 32, 68, 140, 116, -232, -510, -650,
156 -771, -1329, -1052, -152, -317, -907, -710, -104,
157 -1144, -2132, -2598, -301, 662, 827, 1469, 702,
158 2401, 2987, 1574, -244, -1481, -1365, -903, 738,
159 369, -469, 473, 1630, 3124, 1542, -582, -1172,
160 -1381, -317, 4, -610, -40, 1236, 1843, 1493,
161 1349, 417, 389, 630, 686, 188, -228, -168,
162 -742, -795, -1530, -1473, -1903, -3008, -2907, -1317,
163 -445, -2309, -4919, -8939, -5867, 1204, 5293, 5337,
164 4871, 4562, 5602, 5104, 2485, -2337, -5594, -4240,
165 -1694, 867, 1281, 2622, 3638, 4228, 4654, 1405,
166 -1947, -4112, -4184, -3582, -1570, 1325, 2538, 4036,
167 5144, 4630, 2718, 518, -1373, -2397, -1642, -453,
168 349, 1566, 2558, 2493, 1927, 662, -365, -610,
169 -136, 188, 453, 437, -385, -1281, -1196, -1534,
170 -369, 265, -899, -3445, -7176, -4538, -2726, -5650,
171 -13152, -1694, 7040, 11489, 12224, 5971, 1971, 1779,
172 3457, -373, -6040, -7714, -5008, 2594, 7658, 8156,
173 4461, 2333, 4369, 2867, -1919, -7180, -8465, -6409,
174 -2618, 2152, 3120, 4208, 5570, 5558, 4120, 690,
175 -2088, -3345, -1975, -208, 1180, 1738, 2144, 3289,
176 3686, 1819, -417, -1534, -875, 88, 678, 967,
177 437, 558, 951, 20, -1638, -2558, -1967, 558,
178 2289, 465, -4449, -11080, -8931, -6248, -4208, -3337,
179 -6493, -14550, -5068, 12305, 13261, 9742, 4261, 1851,
180 3016, 6971, 441, -9554, -7096, -975, 5188, 6658,
181 5409, 1341, 855, 6164, 1726, -2381, -7991, -7212,
182 -4799, -433, 3236, 3273, 3253, 4445, 6706, 3329,
183 582, -2602, -3028, -1614, -152, 196, 1598, 3638,
184 5144, 4016, 1586, -1004, -2016, -1401, -682, -128,
185 273, 614, 963, 1614, 425, 269, -449, 277,
186 1746, 1240, -1510, -4598, -6397, -8008, -7602, -7152,
187 -7393, -6738, -8606, -15385, -13385, 1192, 12212, 11152,
188 9967, 8622, 5240, 6939, 7369, -2216, -9602, -7425,
189 -999, 3228, 6329, 4702, 4305, 4550, 6216, 3072,
190 -4983, -9313, -9437, -5586, -1987, 2088, 3184, 4662,
191 8244, 6598, 4606, -277, -2718, -3188, -2321, -437,
192 835, 2855, 4638, 4943, 2116, -393, -2269, -2502,
193 -2445, -1630, -646, 469, 1927, 3188, 2943, 502,
194 -3148, -3100, -1144, -642, 658, 1843, 449, -1445
195 } ;
196
197 /* test_codes_32 decoded by a known reference */
198 static const short pcm_data_out32 [] =
199 { 20, 96, 417, 433, 140, -506, -742, -714,
200 -598, -1092, -1044, 56, -445, -702, -622, 76,
201 -1116, -4293, -2429, -433, 606, 1196, 1357, 650,
202 2465, 3040, 1730, -682, -1381, -1759, -867, 518,
203 614, -698, 751, 2172, 3216, 1369, -562, -1076,
204 -1293, -116, -12, -803, -176, 1297, 2228, 1759,
205 1257, 425, 453, 614, 622, 188, -212, -220,
206 -975, -951, -1441, -1309, -1698, -2578, -2405, -1650,
207 -590, -2293, -7052, -8506, -5907, 1100, 5192, 5305,
208 4244, 4425, 6779, 5313, 2152, -2654, -5598, -3803,
209 -2176, 301, 1080, 2281, 3361, 4485, 4690, 1269,
210 -2253, -4477, -4562, -3598, -1345, 1108, 2638, 3783,
211 4819, 4401, 2357, 409, -1180, -2204, -1730, -662,
212 168, 1566, 2550, 2333, 1879, 485, -293, -690,
213 -28, 176, 445, 413, -767, -1088, -1204, -1847,
214 -481, 261, -1321, -8714, -10646, -4265, -1979, -7100,
215 -11678, -1911, 7449, 13333, 11991, 5244, 1935, 1072,
216 3638, -4, -6377, -7650, -4819, 2674, 7148, 8036,
217 4325, 2433, 3855, 2204, -1638, -6361, -8192, -6634,
218 -2184, 2144, 3357, 4164, 4783, 5168, 3835, 1100,
219 -1670, -3224, -2140, -144, 1120, 1755, 2530, 3626,
220 3678, 1771, -281, -1289, -875, 48, 755, 1112,
221 449, 546, 1140, 232, -1530, -2783, -1871, 1128,
222 2216, -1899, -8606, -11333, -10140, -7546, -4357, -2979,
223 -6044, -14851, -3726, 13136, 13477, 9534, 3871, 1489,
224 3526, 7012, 80, -8188, -7140, -1120, 5783, 7060,
225 5823, 1337, 1108, 5566, 2345, -3373, -8140, -7919,
226 -4566, 76, 3060, 2795, 3385, 5907, 6558, 3638,
227 257, -2630, -3401, -1807, -116, 349, 1610, 3417,
228 4750, 3967, 1489, -907, -1923, -1385, -666, -265,
229 253, 682, 1084, 1586, 538, 184, -381, 433,
230 1875, 1289, -1574, -4538, -6168, -8196, -7887, -6750,
231 -7526, -6060, -8148, -16036, -12546, 895, 12991, 12060,
232 10827, 8931, 5321, 8646, 7654, -473, -8582, -6614,
233 -1321, 2803, 6542, 5184, 3847, 4943, 6397, 2148,
234 -4999, -8799, -9614, -5931, -1574, 1546, 3493, 5397,
235 7879, 6919, 4610, 160, -2538, -3582, -2052, -578,
236 1060, 2987, 4843, 4791, 2421, -116, -1987, -2518,
237 -2333, -1534, -855, 365, 1779, 3389, 3080, 477,
238 -3281, -3120, -1188, -265, 638, 2224, 333, -1377
239 } ;
240
241
242 static void
test_nms_adpcm_32(void)243 test_nms_adpcm_32 (void)
244 {
245 struct nms_adpcm_state nms ;
246 int16_t *buffer ;
247 unsigned char code ;
248 int i, j, sl ;
249
250 buffer = (int16_t *) malloc (sizeof (int16_t) * NMS_SAMPLES_PER_BLOCK) ;
251
252 print_test_name ("Testing nms adpcm 32kbs encoder") ;
253
254 nms_adpcm_codec_init (&nms, NMS32) ;
255 for (i = 0 ; i * NMS_BLOCK_SHORTS_32 < ARRAY_LEN (test_codes_32) ; i ++)
256 { /* Unpack the reference */
257 nms_adpcm_block_unpack_32 (&(test_codes_32 [i * NMS_BLOCK_SHORTS_32]), buffer, NULL) ;
258 for (j = 0 ; j < NMS_SAMPLES_PER_BLOCK ; j++)
259 { sl = pcm_data_src [i * NMS_SAMPLES_PER_BLOCK + j] ;
260 code = nms_adpcm_encode_sample (&nms, sl) ;
261 if (code != buffer [j])
262 { printf ("\n\nFail at sample %d (block %d, sample %d). Expected 0x%x got 0x%x\n\n",
263 i * NMS_SAMPLES_PER_BLOCK + j, i, j, buffer [j], code) ;
264 exit (1) ;
265 }
266 }
267 }
268
269 puts ("ok") ;
270
271 print_test_name ("Testing nms adpcm 32kbs decoder") ;
272
273 nms_adpcm_codec_init (&nms, NMS32) ;
274 for (i = 0 ; i * NMS_BLOCK_SHORTS_32 < ARRAY_LEN (test_codes_32) ; i ++)
275 { /* Unpack the code */
276 nms_adpcm_block_unpack_32 (&(test_codes_32 [i * NMS_BLOCK_SHORTS_32]), buffer, NULL) ;
277 for (j = 0 ; j < NMS_SAMPLES_PER_BLOCK ; j++)
278 { sl = nms_adpcm_decode_sample (&nms, buffer [j]) ;
279 if (sl != pcm_data_out32 [i * NMS_SAMPLES_PER_BLOCK + j])
280 { printf ("\n\nFail at sample %d (block %d, sample %d). Expected %d got %d\n\n",
281 i * NMS_SAMPLES_PER_BLOCK + j, i, j, pcm_data_out32 [i * NMS_SAMPLES_PER_BLOCK + j], sl) ;
282 exit (1) ;
283 }
284 }
285 }
286
287 puts ("ok") ;
288
289 free (buffer) ;
290 }
291
292
293 static void
test_nms_adpcm_24(void)294 test_nms_adpcm_24 (void)
295 {
296 struct nms_adpcm_state nms ;
297 int16_t *buffer ;
298 unsigned char code ;
299 int i, j, sl ;
300
301 buffer = (int16_t *) malloc (sizeof (int16_t) * NMS_SAMPLES_PER_BLOCK) ;
302
303
304 print_test_name ("Testing nms adpcm 24kbs encoder") ;
305
306 nms_adpcm_codec_init (&nms, NMS24) ;
307 for (i = 0 ; i * NMS_BLOCK_SHORTS_24 < ARRAY_LEN (test_codes_24) ; i ++)
308 { /* Unpack the reference */
309 nms_adpcm_block_unpack_24 (&test_codes_24 [i * NMS_BLOCK_SHORTS_24], buffer, NULL) ;
310 for (j = 0 ; j < NMS_SAMPLES_PER_BLOCK ; j++)
311 { sl = pcm_data_src [i * NMS_SAMPLES_PER_BLOCK + j] ;
312 code = nms_adpcm_encode_sample (&nms, sl) ;
313 if (code != buffer [j])
314 { printf ("\n\nFail at sample %d (block %d, sample %d). Expected 0x%x got 0x%x\n\n",
315 i * NMS_SAMPLES_PER_BLOCK + j, i, j, buffer [j], code) ;
316 exit (1) ;
317 }
318 }
319 }
320
321 puts ("ok") ;
322
323
324 print_test_name ("Testing nms adpcm 24kbs decoder") ;
325
326 nms_adpcm_codec_init (&nms, NMS24) ;
327 for (i = 0 ; i * NMS_BLOCK_SHORTS_24 < ARRAY_LEN (test_codes_24) ; i ++)
328 { /* Unpack the code */
329 nms_adpcm_block_unpack_24 (&test_codes_24 [i * NMS_BLOCK_SHORTS_24], buffer, NULL) ;
330 for (j = 0 ; j < NMS_SAMPLES_PER_BLOCK ; j++)
331 { sl = nms_adpcm_decode_sample (&nms, buffer [j]) ;
332 if (sl != pcm_data_out24 [i * NMS_SAMPLES_PER_BLOCK + j])
333 { printf ("\n\nFail at sample %d (block %d, sample %d). Expected %d got %d\n\n",
334 i * NMS_SAMPLES_PER_BLOCK + j, i, j, pcm_data_out24 [i * NMS_SAMPLES_PER_BLOCK + j], sl) ;
335 exit (1) ;
336 }
337 }
338 }
339
340 puts ("ok") ;
341
342 free (buffer) ;
343 } /* test_nms_adpcm_24 */
344
345 static void
test_nms_adpcm_16(void)346 test_nms_adpcm_16 (void)
347 { struct nms_adpcm_state nms ;
348 int16_t *buffer ;
349 unsigned char code ;
350 int i, j, sl ;
351
352 buffer = (int16_t *) malloc (sizeof (int16_t) * NMS_SAMPLES_PER_BLOCK) ;
353
354 print_test_name ("Testing nms adpcm 16kbs encoder") ;
355
356 nms_adpcm_codec_init (&nms, NMS16) ;
357 for (i = 0 ; i * NMS_BLOCK_SHORTS_16 < ARRAY_LEN (test_codes_16) ; i ++)
358 { /* Unpack the reference */
359 nms_adpcm_block_unpack_16 (&test_codes_16 [i * NMS_BLOCK_SHORTS_16], buffer, NULL) ;
360 for (j = 0 ; j < NMS_SAMPLES_PER_BLOCK ; j++)
361 { sl = pcm_data_src [i * NMS_SAMPLES_PER_BLOCK + j] ;
362 code = nms_adpcm_encode_sample (&nms, sl) ;
363 if (code != buffer [j])
364 { printf ("\n\nFail at sample %d (block %d, sample %d). Expected 0x%x got 0x%x\n\n",
365 i * NMS_SAMPLES_PER_BLOCK + j, i, j, buffer [j], code) ;
366 exit (1) ;
367 }
368 }
369 }
370
371 puts ("ok") ;
372
373 print_test_name ("Testing nms adpcm 16kbs decoder") ;
374
375 nms_adpcm_codec_init (&nms, NMS16) ;
376 for (i = 0 ; i * NMS_BLOCK_SHORTS_16 < ARRAY_LEN (test_codes_16) ; i ++)
377 { /* Unpack the code */
378 nms_adpcm_block_unpack_16 (&test_codes_16 [i * NMS_BLOCK_SHORTS_16], buffer, NULL) ;
379 for (j = 0 ; j < NMS_SAMPLES_PER_BLOCK ; j++)
380 { sl = nms_adpcm_decode_sample (&nms, buffer [j]) ;
381 if (sl != pcm_data_out16 [i * NMS_SAMPLES_PER_BLOCK + j])
382 { printf ("\n\nFail at sample %d (block %d, sample %d). Expected %d got %d\n\n",
383 i * NMS_SAMPLES_PER_BLOCK + j, i, j, pcm_data_out16 [i * NMS_SAMPLES_PER_BLOCK + j], sl) ;
384 exit (1) ;
385 }
386 }
387 }
388
389 puts ("ok") ;
390
391 free (buffer) ;
392 } /* test_nms_adpcm_16 */
393
394 void
test_nms_adpcm(void)395 test_nms_adpcm (void)
396 { test_nms_adpcm_32 () ;
397 test_nms_adpcm_24 () ;
398 test_nms_adpcm_16 () ;
399 } /* main */
400
401