• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/minidlna/flac-1.2.1/src/test_libFLAC/

Lines Matching refs:bw

51 #define TOTAL_BITS(bw) ((bw)->words*sizeof(bwword)*8 + (bw)->bits)
56 FLAC__BitWriter *bw;
64 unsigned words, bits; /* what we think bw->words and bw->bits should be */
72 bw = FLAC__bitwriter_new();
73 if(0 == bw) {
80 FLAC__bitwriter_delete(bw);
87 bw = FLAC__bitwriter_new();
88 if(0 == bw) {
95 FLAC__bitwriter_init(bw);
96 if(0 == bw) {
103 FLAC__bitwriter_delete(bw);
110 bw = FLAC__bitwriter_new();
111 if(0 == bw) {
118 FLAC__bitwriter_init(bw);
119 if(0 == bw) {
126 FLAC__bitwriter_clear(bw);
127 if(0 == bw) {
134 FLAC__bitwriter_delete(bw);
141 bw = FLAC__bitwriter_new();
142 if(0 == bw) {
149 ok = FLAC__bitwriter_init(bw);
155 FLAC__bitwriter_clear(bw);
160 printf("capacity = %u\n", bw->capacity);
164 FLAC__bitwriter_write_raw_uint32(bw, 0x1, 1) &&
165 FLAC__bitwriter_write_raw_uint32(bw, 0x1, 2) &&
166 FLAC__bitwriter_write_raw_uint32(bw, 0xa, 5) &&
167 FLAC__bitwriter_write_raw_uint32(bw, 0xf0, 8) &&
168 FLAC__bitwriter_write_raw_uint32(bw, 0x2aa, 10) &&
169 FLAC__bitwriter_write_raw_uint32(bw, 0xf, 4) &&
170 FLAC__bitwriter_write_raw_uint32(bw, 0xaaaaaaaa, 32) &&
171 FLAC__bitwriter_write_zeroes(bw, 4) &&
172 FLAC__bitwriter_write_raw_uint32(bw, 0x3, 2) &&
173 FLAC__bitwriter_write_zeroes(bw, 8) &&
174 FLAC__bitwriter_write_raw_uint64(bw, FLAC__U64L(0xaaaaaaaadeadbeef), 64) &&
175 FLAC__bitwriter_write_raw_uint32(bw, 0xace, 12)
179 FLAC__bitwriter_dump(bw, stdout);
184 if(bw->words != words) {
185 printf("FAILED byte count %u != %u\n", bw->words, words);
186 FLAC__bitwriter_dump(bw, stdout);
189 if(bw->bits != bits) {
190 printf("FAILED bit count %u != %u\n", bw->bits, bits);
191 FLAC__bitwriter_dump(bw, stdout);
194 if(memcmp(bw->buffer, test_pattern1, sizeof(bwword)*words) != 0) {
196 FLAC__bitwriter_dump(bw, stdout);
199 if((bw->accum & 0x00ffffff) != test_pattern1[words]) {
200 printf("FAILED pattern match (bw->accum=%08X != %08X)\n", bw->accum&0x00ffffff, test_pattern1[words]);
201 FLAC__bitwriter_dump(bw, stdout);
205 FLAC__bitwriter_dump(bw, stdout);
208 ok = FLAC__bitwriter_write_raw_uint32(bw, 0x3d, 6);
211 FLAC__bitwriter_dump(bw, stdout);
217 if(bw->words != words) {
218 printf("FAILED byte count %u != %u\n", bw->words, words);
219 FLAC__bitwriter_dump(bw, stdout);
222 if(bw->bits != bits) {
223 printf("FAILED bit count %u != %u\n", bw->bits, bits);
224 FLAC__bitwriter_dump(bw, stdout);
227 if(memcmp(bw->buffer, test_pattern1, sizeof(bwword)*words) != 0) {
229 FLAC__bitwriter_dump(bw, stdout);
232 if((bw->accum & 0x3fffffff) != test_pattern1[words]) {
233 printf("FAILED pattern match (bw->accum=%08X != %08X)\n", bw->accum&0x3fffffff, test_pattern1[words]);
234 FLAC__bitwriter_dump(bw, stdout);
238 FLAC__bitwriter_dump(bw, stdout);
241 FLAC__bitwriter_clear(bw);
242 FLAC__bitwriter_write_utf8_uint32(bw, 0x00000000);
243 ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0;
246 FLAC__bitwriter_dump(bw, stdout);
251 FLAC__bitwriter_clear(bw);
252 FLAC__bitwriter_write_utf8_uint32(bw, 0x0000007F);
253 ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0x7F;
256 FLAC__bitwriter_dump(bw, stdout);
261 FLAC__bitwriter_clear(bw);
262 FLAC__bitwriter_write_utf8_uint32(bw, 0x00000080);
263 ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xC280;
266 FLAC__bitwriter_dump(bw, stdout);
271 FLAC__bitwriter_clear(bw);
272 FLAC__bitwriter_write_utf8_uint32(bw, 0x000007FF);
273 ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xDFBF;
276 FLAC__bitwriter_dump(bw, stdout);
281 FLAC__bitwriter_clear(bw);
282 FLAC__bitwriter_write_utf8_uint32(bw, 0x00000800);
283 ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xE0A080;
286 FLAC__bitwriter_dump(bw, stdout);
291 FLAC__bitwriter_clear(bw);
292 FLAC__bitwriter_write_utf8_uint32(bw, 0x0000FFFF);
293 ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xEFBFBF;
296 FLAC__bitwriter_dump(bw, stdout);
301 FLAC__bitwriter_clear(bw);
302 FLAC__bitwriter_write_utf8_uint32(bw, 0x00010000);
304 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF0908080;
306 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0x808090F0;
310 FLAC__bitwriter_dump(bw, stdout);
315 FLAC__bitwriter_clear(bw);
316 FLAC__bitwriter_write_utf8_uint32(bw, 0x001FFFFF);
318 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF7BFBFBF;
320 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xBFBFBFF7;
324 FLAC__bitwriter_dump(bw, stdout);
329 FLAC__bitwriter_clear(bw);
330 FLAC__bitwriter_write_utf8_uint32(bw, 0x00200000);
332 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xF8888080 && (bw->accum & 0xff) == 0x80;
334 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0x808088F8 && (bw->accum & 0xff) == 0x80;
338 FLAC__bitwriter_dump(bw, stdout);
343 FLAC__bitwriter_clear(bw);
344 FLAC__bitwriter_write_utf8_uint32(bw, 0x03FFFFFF);
346 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xFBBFBFBF && (bw->accum & 0xff) == 0xBF;
348 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xBFBFBFFB && (bw->accum & 0xff) == 0xBF;
352 FLAC__bitwriter_dump(bw, stdout);
357 FLAC__bitwriter_clear(bw);
358 FLAC__bitwriter_write_utf8_uint32(bw, 0x04000000);
360 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFC848080 && (bw->accum & 0xffff) == 0x8080;
362 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0x808084FC && (bw->accum & 0xffff) == 0x8080;
366 FLAC__bitwriter_dump(bw, stdout);
371 FLAC__bitwriter_clear(bw);
372 FLAC__bitwriter_write_utf8_uint32(bw, 0x7FFFFFFF);
374 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFDBFBFBF && (bw->accum & 0xffff) == 0xBFBF;
376 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xBFBFBFFD && (bw->accum & 0xffff) == 0xBFBF;
380 FLAC__bitwriter_dump(bw, stdout);
385 FLAC__bitwriter_clear(bw);
386 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000000000);
387 ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0;
390 FLAC__bitwriter_dump(bw, stdout);
395 FLAC__bitwriter_clear(bw);
396 FLAC__bitwriter_write_utf8_uint64(bw, 0x000000000000007F);
397 ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0x7F;
400 FLAC__bitwriter_dump(bw, stdout);
405 FLAC__bitwriter_clear(bw);
406 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000000080);
407 ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xC280;
410 FLAC__bitwriter_dump(bw, stdout);
415 FLAC__bitwriter_clear(bw);
416 FLAC__bitwriter_write_utf8_uint64(bw, 0x00000000000007FF);
417 ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xDFBF;
420 FLAC__bitwriter_dump(bw, stdout);
425 FLAC__bitwriter_clear(bw);
426 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000000800);
427 ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xE0A080;
430 FLAC__bitwriter_dump(bw, stdout);
435 FLAC__bitwriter_clear(bw);
436 FLAC__bitwriter_write_utf8_uint64(bw, 0x000000000000FFFF);
437 ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xEFBFBF;
440 FLAC__bitwriter_dump(bw, stdout);
445 FLAC__bitwriter_clear(bw);
446 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000010000);
448 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF0908080;
450 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0x808090F0;
454 FLAC__bitwriter_dump(bw, stdout);
459 FLAC__bitwriter_clear(bw);
460 FLAC__bitwriter_write_utf8_uint64(bw, 0x00000000001FFFFF);
462 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF7BFBFBF;
464 ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xBFBFBFF7;
468 FLAC__bitwriter_dump(bw, stdout);
473 FLAC__bitwriter_clear(bw);
474 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000200000);
476 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xF8888080 && (bw->accum & 0xff) == 0x80;
478 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0x808088F8 && (bw->accum & 0xff) == 0x80;
482 FLAC__bitwriter_dump(bw, stdout);
487 FLAC__bitwriter_clear(bw);
488 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000003FFFFFF);
490 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xFBBFBFBF && (bw->accum & 0xff) == 0xBF;
492 ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xBFBFBFFB && (bw->accum & 0xff) == 0xBF;
496 FLAC__bitwriter_dump(bw, stdout);
501 FLAC__bitwriter_clear(bw);
502 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000004000000);
504 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFC848080 && (bw->accum & 0xffff) == 0x8080;
506 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0x808084FC && (bw->accum & 0xffff) == 0x8080;
510 FLAC__bitwriter_dump(bw, stdout);
515 FLAC__bitwriter_clear(bw);
516 FLAC__bitwriter_write_utf8_uint64(bw, 0x000000007FFFFFFF);
518 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFDBFBFBF && (bw->accum & 0xffff) == 0xBFBF;
520 ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xBFBFBFFD && (bw->accum & 0xffff) == 0xBFBF;
524 FLAC__bitwriter_dump(bw, stdout);
529 FLAC__bitwriter_clear(bw);
530 FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000080000000);
532 ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0xFE828080 && (bw->accum & 0xffffff) == 0x808080;
534 ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0x808082FE && (bw->accum & 0xffffff) == 0x808080;
538 FLAC__bitwriter_dump(bw, stdout);
543 FLAC__bitwriter_clear(bw);
544 FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000FFFFFFFFF));
546 ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0xFEBFBFBF && (bw->accum & 0xffffff) == 0xBFBFBF;
548 ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0xBFBFBFFE && (bw->accum & 0xffffff) == 0xBFBFBF;
552 FLAC__bitwriter_dump(bw, stdout);
557 FLAC__bitwriter_clear(bw);
558 FLAC__bitwriter_write_raw_uint32(bw, 0x5, 4);
559 j = bw->capacity;
561 FLAC__bitwriter_write_raw_uint32(bw, 0xaaaaaaaa, 32);
563 ok = TOTAL_BITS(bw) == i*32+4 && bw->buffer[0] == 0x5aaaaaaa && (bw->accum & 0xf) == 0xa;
565 ok = TOTAL_BITS(bw) == i*32+4 && bw->buffer[0] == 0xaaaaaa5a && (bw->accum & 0xf) == 0xa;
569 FLAC__bitwriter_dump(bw, stdout);
572 printf("capacity = %u\n", bw->capacity);
575 FLAC__bitwriter_free(bw);
579 FLAC__bitwriter_delete(bw);