]> git.sesse.net Git - ffmpeg/commitdiff
Optimize h261_probe function, since it is far slower than all others.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 14 Feb 2010 18:59:56 +0000 (18:59 +0000)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 14 Feb 2010 18:59:56 +0000 (18:59 +0000)
About 5 times faster.

Originally committed as revision 21823 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/raw.c

index f4d7bb16c3b02a6759b4095654a02283a92c6b0c..df3b01754d82e7b3c9ae8b01f4b21a77eef81215 100644 (file)
@@ -497,6 +497,10 @@ static int h261_probe(AVProbeData *p)
     init_get_bits(&gb, p->buf, p->buf_size*8);
 
     for(i=0; i<p->buf_size*8; i++){
+        if ((code & 0x01ff0000) || !(code & 0xff00)) {
+            code = (code<<8) + get_bits(&gb, 8);
+            i += 7;
+        } else
         code = (code<<1) + get_bits1(&gb);
         if ((code & 0xffff0000) == 0x10000) {
             int gn= (code>>12)&0xf;