comparison wmadec.c @ 5513:9f8219a3b86f libavcodec

use get_bits1(..) instead get_bits(.., 1)
author alex
date Thu, 09 Aug 2007 00:13:31 +0000
parents bff60ecc02f9
children 998ed46cfa66
comparison
equal deleted inserted replaced
5512:28dcc5cd79d2 5513:9f8219a3b86f
391 s->block_len = 1 << s->block_len_bits; 391 s->block_len = 1 << s->block_len_bits;
392 if ((s->block_pos + s->block_len) > s->frame_len) 392 if ((s->block_pos + s->block_len) > s->frame_len)
393 return -1; 393 return -1;
394 394
395 if (s->nb_channels == 2) { 395 if (s->nb_channels == 2) {
396 s->ms_stereo = get_bits(&s->gb, 1); 396 s->ms_stereo = get_bits1(&s->gb);
397 } 397 }
398 v = 0; 398 v = 0;
399 for(ch = 0; ch < s->nb_channels; ch++) { 399 for(ch = 0; ch < s->nb_channels; ch++) {
400 a = get_bits(&s->gb, 1); 400 a = get_bits1(&s->gb);
401 s->channel_coded[ch] = a; 401 s->channel_coded[ch] = a;
402 v |= a; 402 v |= a;
403 } 403 }
404 /* if no channel coded, no need to go further */ 404 /* if no channel coded, no need to go further */
405 /* XXX: fix potential framing problems */ 405 /* XXX: fix potential framing problems */
431 for(ch = 0; ch < s->nb_channels; ch++) { 431 for(ch = 0; ch < s->nb_channels; ch++) {
432 if (s->channel_coded[ch]) { 432 if (s->channel_coded[ch]) {
433 int i, n, a; 433 int i, n, a;
434 n = s->exponent_high_sizes[bsize]; 434 n = s->exponent_high_sizes[bsize];
435 for(i=0;i<n;i++) { 435 for(i=0;i<n;i++) {
436 a = get_bits(&s->gb, 1); 436 a = get_bits1(&s->gb);
437 s->high_band_coded[ch][i] = a; 437 s->high_band_coded[ch][i] = a;
438 /* if noise coding, the coefficients are not transmitted */ 438 /* if noise coding, the coefficients are not transmitted */
439 if (a) 439 if (a)
440 nb_coefs[ch] -= s->exponent_high_bands[bsize][i]; 440 nb_coefs[ch] -= s->exponent_high_bands[bsize][i];
441 } 441 }
464 } 464 }
465 } 465 }
466 466
467 /* exponents can be reused in short blocks. */ 467 /* exponents can be reused in short blocks. */
468 if ((s->block_len_bits == s->frame_len_bits) || 468 if ((s->block_len_bits == s->frame_len_bits) ||
469 get_bits(&s->gb, 1)) { 469 get_bits1(&s->gb)) {
470 for(ch = 0; ch < s->nb_channels; ch++) { 470 for(ch = 0; ch < s->nb_channels; ch++) {
471 if (s->channel_coded[ch]) { 471 if (s->channel_coded[ch]) {
472 if (s->use_exp_vlc) { 472 if (s->use_exp_vlc) {
473 if (decode_exp_vlc(s, ch) < 0) 473 if (decode_exp_vlc(s, ch) < 0)
474 return -1; 474 return -1;
514 } else { 514 } else {
515 /* normal code */ 515 /* normal code */
516 run = run_table[code]; 516 run = run_table[code];
517 level = level_table[code]; 517 level = level_table[code];
518 } 518 }
519 sign = get_bits(&s->gb, 1); 519 sign = get_bits1(&s->gb);
520 if (!sign) 520 if (!sign)
521 level = -level; 521 level = -level;
522 ptr += run; 522 ptr += run;
523 if (ptr >= eptr) 523 if (ptr >= eptr)
524 { 524 {