mpegvideoparse: accelerate search for start code

As the startcode always starts with 0x000001 some iterations
can be skipped if values > 1 are detected.

~ 70% faster on HD video stream.

https://bugzilla.gnome.org/show_bug.cgi?id=632130
This commit is contained in:
Thijs Vermeir 2010-10-14 11:45:55 +02:00
parent 9f4339c059
commit 96a7f9c8b1

View file

@ -108,6 +108,16 @@ mpeg_util_find_start_code (guint32 * sync_word, guint8 * cur, guint8 * end)
return cur;
}
/* accelerate search for start code */
if (*cur > 1) {
while (cur < (end - 4) && *cur > 1)
if (cur[3] > 1)
cur += 4;
else
cur++;
code = 0xffffff00;
}
/* Add the next available byte to the collected sync word */
code |= *cur++;
}