[SCM] libav/experimental: Add ff_h263_find_resync_marker() to find the bit position of the next resync_marker, if any. patch by Gwenole Beauchesne gbeauchesne splitted-desktopcom based on suggested implementation by me

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:39:23 UTC 2013


The following commit has been merged in the experimental branch:
commit ee3e36315e25d74da1079b4bafe3fd36fc9f3406
Author: Gwenole Beauchesne <gbeauchesne at splitted-desktop.com>
Date:   Tue Feb 24 16:12:47 2009 +0000

    Add ff_h263_find_resync_marker() to find the bit position of the next resync_marker, if any.
    patch by Gwenole Beauchesne gbeauchesne splitted-desktopcom
    based on suggested implementation by me
    
    Originally committed as revision 17560 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index b02b0ad..2a25cda 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -3293,6 +3293,27 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s)
 }
 
 /**
+ * finds the next resync_marker
+ * @param p pointer to buffer to scan
+ * @param end pointer to the end of the buffer
+ * @return pointer to the next resync_marker, or \p end if none was found
+ */
+const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8_t * restrict end)
+{
+    assert(p < end);
+
+    end-=2;
+    p++;
+    for(;p<end; p+=2){
+        if(!*p){
+            if     (!p[-1] && p[1]) return p - 1;
+            else if(!p[ 1] && p[2]) return p;
+        }
+    }
+    return end+2;
+}
+
+/**
  * decodes the group of blocks / video packet header.
  * @return bit position of the resync_marker, or <0 if none was found
  */
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 32ad5f4..453285e 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -836,6 +836,7 @@ void ff_clean_h263_qscales(MpegEncContext *s);
 int ff_mpeg4_decode_partitions(MpegEncContext *s);
 int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
 int ff_h263_resync(MpegEncContext *s);
+const uint8_t *ff_h263_find_resync_marker(const uint8_t *p, const uint8_t *end);
 int ff_h263_get_gob_height(MpegEncContext *s);
 void ff_mpeg4_init_direct_mv(MpegEncContext *s);
 int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list