[gst-cvs] gst-plugins-bad: mpegvideoparse: accelerate search for start code

Thijs Vermeir tvermeir at kemper.freedesktop.org
Thu Oct 14 09:53:46 PDT 2010


Module: gst-plugins-bad
Branch: master
Commit: 96a7f9c8b1195129f0c2157cbbcbaa6cab45056e
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=96a7f9c8b1195129f0c2157cbbcbaa6cab45056e

Author: Thijs Vermeir <thijsvermeir at gmail.com>
Date:   Thu Oct 14 11:45:55 2010 +0200

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

---

 gst/mpegvideoparse/mpegpacketiser.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/gst/mpegvideoparse/mpegpacketiser.c b/gst/mpegvideoparse/mpegpacketiser.c
index fb8c9f5..694c476 100644
--- a/gst/mpegvideoparse/mpegpacketiser.c
+++ b/gst/mpegvideoparse/mpegpacketiser.c
@@ -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++;
   }





More information about the Gstreamer-commits mailing list