comparison svq1enc.c @ 10832:f20726a6d538 libavcodec

Add a function to match a 2 element vector of uint16_t and use it in h263 and svq1 instead of custom and bloated code to find an index into a w/h array.
author michael
date Sat, 09 Jan 2010 18:33:21 +0000
parents d0657e337f91
children f6afc7837f83
comparison
equal deleted inserted replaced
10831:94982978af3b 10832:f20726a6d538
92 /* no embedded string either */ 92 /* no embedded string either */
93 93
94 /* output 5 unknown bits (2 + 2 + 1) */ 94 /* output 5 unknown bits (2 + 2 + 1) */
95 put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */ 95 put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
96 96
97 for (i = 0; i < 7; i++) 97 i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
98 { 98 put_bits(&s->pb, 3, i);
99 if ((ff_svq1_frame_size_table[i].width == s->frame_width) &&
100 (ff_svq1_frame_size_table[i].height == s->frame_height))
101 {
102 put_bits(&s->pb, 3, i);
103 break;
104 }
105 }
106 99
107 if (i == 7) 100 if (i == 7)
108 { 101 {
109 put_bits(&s->pb, 3, 7);
110 put_bits(&s->pb, 12, s->frame_width); 102 put_bits(&s->pb, 12, s->frame_width);
111 put_bits(&s->pb, 12, s->frame_height); 103 put_bits(&s->pb, 12, s->frame_height);
112 } 104 }
113 } 105 }
114 106