diff 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
line wrap: on
line diff
--- a/svq1enc.c	Sat Jan 09 18:12:06 2010 +0000
+++ b/svq1enc.c	Sat Jan 09 18:33:21 2010 +0000
@@ -94,19 +94,11 @@
         /* output 5 unknown bits (2 + 2 + 1) */
         put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
 
-        for (i = 0; i < 7; i++)
-        {
-            if ((ff_svq1_frame_size_table[i].width == s->frame_width) &&
-                (ff_svq1_frame_size_table[i].height == s->frame_height))
-            {
-                put_bits(&s->pb, 3, i);
-                break;
-            }
-        }
+        i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
+        put_bits(&s->pb, 3, i);
 
         if (i == 7)
         {
-            put_bits(&s->pb, 3, 7);
                 put_bits(&s->pb, 12, s->frame_width);
                 put_bits(&s->pb, 12, s->frame_height);
         }