]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Add ff_h263_find_resync_marker() to find the bit position of the next resync_marker...
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 24 Feb 2009 16:12:47 +0000 (16:12 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 24 Feb 2009 16:12:47 +0000 (16:12 +0000)
patch by Gwenole Beauchesne gbeauchesne splitted-desktopcom
based on suggested implementation by me

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17560 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/h263.c
libavcodec/mpegvideo.h

index b02b0ad2f4cc577f9039e8e9f1ffcf8ae991fe36..2a25cdae671645e34d1e5dfc1ef8dd274b943331 100644 (file)
@@ -3292,6 +3292,27 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s)
     s->last_mv[1][0][1]= 0;
 }
 
+/**
+ * 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
index 32ad5f4c6cad4b881c815ce5edf2ccb2fa16e6e0..453285e317ea45f4d375fcbdb55aefa301cf3dea 100644 (file)
@@ -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);