comparison vp3.c @ 11152:b3ff7fcfffc4 libavcodec

Directly check whether a fragment is coded for 4MV mode instead of iterating through the entire coded fragment list.
author conrad
date Sat, 13 Feb 2010 18:55:27 +0000
parents d649b7f938c8
children 3827267cc207
comparison
equal deleted inserted replaced
11151:d649b7f938c8 11152:b3ff7fcfffc4
733 * This function unpacks all the motion vectors for the individual 733 * This function unpacks all the motion vectors for the individual
734 * macroblocks from the bitstream. 734 * macroblocks from the bitstream.
735 */ 735 */
736 static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) 736 static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
737 { 737 {
738 int j, k, l, sb_x, sb_y; 738 int j, k, sb_x, sb_y;
739 int coding_mode; 739 int coding_mode;
740 int motion_x[6]; 740 int motion_x[6];
741 int motion_y[6]; 741 int motion_y[6];
742 int last_motion_x = 0; 742 int last_motion_x = 0;
743 int last_motion_y = 0; 743 int last_motion_y = 0;
800 /* fetch 4 vectors from the bitstream, one for each 800 /* fetch 4 vectors from the bitstream, one for each
801 * Y fragment, then average for the C fragment vectors */ 801 * Y fragment, then average for the C fragment vectors */
802 motion_x[4] = motion_y[4] = 0; 802 motion_x[4] = motion_y[4] = 0;
803 for (k = 0; k < 4; k++) { 803 for (k = 0; k < 4; k++) {
804 current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X; 804 current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X;
805 for (l = 0; l < s->coded_fragment_list_index; l++) 805 if (s->all_fragments[current_fragment].coding_method != MODE_COPY) {
806 if (s->coded_fragment_list[l] == current_fragment)
807 break;
808 if (l < s->coded_fragment_list_index) {
809 if (coding_mode == 0) { 806 if (coding_mode == 0) {
810 motion_x[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)]; 807 motion_x[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
811 motion_y[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)]; 808 motion_y[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
812 } else { 809 } else {
813 motion_x[k] = fixed_motion_vector_table[get_bits(gb, 6)]; 810 motion_x[k] = fixed_motion_vector_table[get_bits(gb, 6)];