[FFmpeg-devel] [PATCH 1/2] avcodec/vc1: simplify find_next_marker()

zhaoxiu.zeng zhaoxiu.zeng at gmail.com
Thu Feb 12 17:02:04 CET 2015


>From ae973955c4e8a16ad38843cef60639f9bd69abee Mon Sep 17 00:00:00 2001
From: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
Date: Thu, 12 Feb 2015 23:22:59 +0800
Subject: [PATCH 1/2] avcodec/vc1: simplify find_next_marker()

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng at gmail.com>
---
 libavcodec/vc1_common.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vc1_common.h b/libavcodec/vc1_common.h
index cd67b17..b46c33f 100644
--- a/libavcodec/vc1_common.h
+++ b/libavcodec/vc1_common.h
@@ -26,6 +26,7 @@
 #include <stdint.h>
 
 #include "libavutil/attributes.h"
+#include "internal.h"
 
 /** Markers used in VC-1 AP frame data */
 //@{
@@ -57,12 +58,9 @@ enum Profile {
  */
 static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end)
 {
-    uint32_t mrk = 0xFFFFFFFF;
-
-    if (end-src < 4)
-        return end;
-    while (src < end) {
-        mrk = (mrk << 8) | *src++;
+    if (end - src >= 4) {
+        uint32_t mrk = 0xFFFFFFFF;
+        src = avpriv_find_start_code(src, end, &mrk);
         if (IS_MARKER(mrk))
             return src - 4;
     }
-- 
2.1.0



More information about the ffmpeg-devel mailing list