comparison vp3.c @ 5513:9f8219a3b86f libavcodec

use get_bits1(..) instead get_bits(.., 1)
author alex
date Thu, 09 Aug 2007 00:13:31 +0000
parents a6954173e82f
children 8c7173e5d08c
comparison
equal deleted inserted replaced
5512:28dcc5cd79d2 5513:9f8219a3b86f
684 memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count); 684 memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count);
685 685
686 } else { 686 } else {
687 687
688 /* unpack the list of partially-coded superblocks */ 688 /* unpack the list of partially-coded superblocks */
689 bit = get_bits(gb, 1); 689 bit = get_bits1(gb);
690 /* toggle the bit because as soon as the first run length is 690 /* toggle the bit because as soon as the first run length is
691 * fetched the bit will be toggled again */ 691 * fetched the bit will be toggled again */
692 bit ^= 1; 692 bit ^= 1;
693 while (current_superblock < s->superblock_count) { 693 while (current_superblock < s->superblock_count) {
694 if (current_run-- == 0) { 694 if (current_run-- == 0) {
720 * not marked as partially coded in the previous step */ 720 * not marked as partially coded in the previous step */
721 if (decode_fully_flags) { 721 if (decode_fully_flags) {
722 722
723 current_superblock = 0; 723 current_superblock = 0;
724 current_run = 0; 724 current_run = 0;
725 bit = get_bits(gb, 1); 725 bit = get_bits1(gb);
726 /* toggle the bit because as soon as the first run length is 726 /* toggle the bit because as soon as the first run length is
727 * fetched the bit will be toggled again */ 727 * fetched the bit will be toggled again */
728 bit ^= 1; 728 bit ^= 1;
729 while (current_superblock < s->superblock_count) { 729 while (current_superblock < s->superblock_count) {
730 730
751 /* if there were partial blocks, initialize bitstream for 751 /* if there were partial blocks, initialize bitstream for
752 * unpacking fragment codings */ 752 * unpacking fragment codings */
753 if (decode_partial_blocks) { 753 if (decode_partial_blocks) {
754 754
755 current_run = 0; 755 current_run = 0;
756 bit = get_bits(gb, 1); 756 bit = get_bits1(gb);
757 /* toggle the bit because as soon as the first run length is 757 /* toggle the bit because as soon as the first run length is
758 * fetched the bit will be toggled again */ 758 * fetched the bit will be toggled again */
759 bit ^= 1; 759 bit ^= 1;
760 } 760 }
761 } 761 }
977 977
978 memset(motion_x, 0, 6 * sizeof(int)); 978 memset(motion_x, 0, 6 * sizeof(int));
979 memset(motion_y, 0, 6 * sizeof(int)); 979 memset(motion_y, 0, 6 * sizeof(int));
980 980
981 /* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */ 981 /* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */
982 coding_mode = get_bits(gb, 1); 982 coding_mode = get_bits1(gb);
983 debug_vectors(" using %s scheme for unpacking motion vectors\n", 983 debug_vectors(" using %s scheme for unpacking motion vectors\n",
984 (coding_mode == 0) ? "VLC" : "fixed-length"); 984 (coding_mode == 0) ? "VLC" : "fixed-length");
985 985
986 /* iterate through all of the macroblocks that contain 1 or more 986 /* iterate through all of the macroblocks that contain 1 or more
987 * coded fragments */ 987 * coded fragments */
2335 2335
2336 static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb) 2336 static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
2337 { 2337 {
2338 Vp3DecodeContext *s = avctx->priv_data; 2338 Vp3DecodeContext *s = avctx->priv_data;
2339 2339
2340 if (get_bits(gb, 1)) { 2340 if (get_bits1(gb)) {
2341 int token; 2341 int token;
2342 if (s->entries >= 32) { /* overflow */ 2342 if (s->entries >= 32) { /* overflow */
2343 av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n"); 2343 av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
2344 return -1; 2344 return -1;
2345 } 2345 }
2486 2486
2487 for (inter = 0; inter <= 1; inter++) { 2487 for (inter = 0; inter <= 1; inter++) {
2488 for (plane = 0; plane <= 2; plane++) { 2488 for (plane = 0; plane <= 2; plane++) {
2489 int newqr= 1; 2489 int newqr= 1;
2490 if (inter || plane > 0) 2490 if (inter || plane > 0)
2491 newqr = get_bits(gb, 1); 2491 newqr = get_bits1(gb);
2492 if (!newqr) { 2492 if (!newqr) {
2493 int qtj, plj; 2493 int qtj, plj;
2494 if(inter && get_bits(gb, 1)){ 2494 if(inter && get_bits1(gb)){
2495 qtj = 0; 2495 qtj = 0;
2496 plj = plane; 2496 plj = plane;
2497 }else{ 2497 }else{
2498 qtj= (3*inter + plane - 1) / 3; 2498 qtj= (3*inter + plane - 1) / 3;
2499 plj= (plane + 2) % 3; 2499 plj= (plane + 2) % 3;
2530 2530
2531 /* Huffman tables */ 2531 /* Huffman tables */
2532 for (s->hti = 0; s->hti < 80; s->hti++) { 2532 for (s->hti = 0; s->hti < 80; s->hti++) {
2533 s->entries = 0; 2533 s->entries = 0;
2534 s->huff_code_size = 1; 2534 s->huff_code_size = 1;
2535 if (!get_bits(gb, 1)) { 2535 if (!get_bits1(gb)) {
2536 s->hbits = 0; 2536 s->hbits = 0;
2537 read_huffman_tree(avctx, gb); 2537 read_huffman_tree(avctx, gb);
2538 s->hbits = 1; 2538 s->hbits = 1;
2539 read_huffman_tree(avctx, gb); 2539 read_huffman_tree(avctx, gb);
2540 } 2540 }