comparison vp3.c @ 11153:3827267cc207 libavcodec

Move branch based on custom mode outside the loop
author conrad
date Sat, 13 Feb 2010 18:59:21 +0000
parents b3ff7fcfffc4
children c11bcf7e3e6b
comparison
equal deleted inserted replaced
11152:b3ff7fcfffc4 11153:3827267cc207
646 int scheme; 646 int scheme;
647 int current_macroblock; 647 int current_macroblock;
648 int current_fragment; 648 int current_fragment;
649 int coding_mode; 649 int coding_mode;
650 int custom_mode_alphabet[CODING_MODE_COUNT]; 650 int custom_mode_alphabet[CODING_MODE_COUNT];
651 const int *alphabet;
651 652
652 if (s->keyframe) { 653 if (s->keyframe) {
653 for (i = 0; i < s->fragment_count; i++) 654 for (i = 0; i < s->fragment_count; i++)
654 s->all_fragments[i].coding_method = MODE_INTRA; 655 s->all_fragments[i].coding_method = MODE_INTRA;
655 656
662 if (scheme == 0) { 663 if (scheme == 0) {
663 for (i = 0; i < 8; i++) 664 for (i = 0; i < 8; i++)
664 custom_mode_alphabet[i] = MODE_INTER_NO_MV; 665 custom_mode_alphabet[i] = MODE_INTER_NO_MV;
665 for (i = 0; i < 8; i++) 666 for (i = 0; i < 8; i++)
666 custom_mode_alphabet[get_bits(gb, 3)] = i; 667 custom_mode_alphabet[get_bits(gb, 3)] = i;
667 } 668 alphabet = custom_mode_alphabet;
669 } else
670 alphabet = ModeAlphabet[scheme-1];
668 671
669 /* iterate through all of the macroblocks that contain 1 or more 672 /* iterate through all of the macroblocks that contain 1 or more
670 * coded fragments */ 673 * coded fragments */
671 for (sb_y = 0; sb_y < s->y_superblock_height; sb_y++) { 674 for (sb_y = 0; sb_y < s->y_superblock_height; sb_y++) {
672 for (sb_x = 0; sb_x < s->y_superblock_width; sb_x++) { 675 for (sb_x = 0; sb_x < s->y_superblock_width; sb_x++) {
695 } 698 }
696 699
697 /* mode 7 means get 3 bits for each coding mode */ 700 /* mode 7 means get 3 bits for each coding mode */
698 if (scheme == 7) 701 if (scheme == 7)
699 coding_mode = get_bits(gb, 3); 702 coding_mode = get_bits(gb, 3);
700 else if(scheme == 0)
701 coding_mode = custom_mode_alphabet
702 [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
703 else 703 else
704 coding_mode = ModeAlphabet[scheme-1] 704 coding_mode = alphabet
705 [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)]; 705 [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
706 706
707 s->macroblock_coding[current_macroblock] = coding_mode; 707 s->macroblock_coding[current_macroblock] = coding_mode;
708 for (k = 0; k < 4; k++) { 708 for (k = 0; k < 4; k++) {
709 current_fragment = 709 current_fragment =