[FFmpeg-cvslog] Check resync marker only when enabled.

Anuj Mittal git at videolan.org
Tue Oct 9 16:55:56 CEST 2012


ffmpeg | branch: master | Anuj Mittal <am.devel at gmail.com> | Tue Oct  9 18:40:26 2012 +0530| [ce19aec15b4291dc48e791d89a1f940babc22cdc] | committer: Michael Niedermayer

Check resync marker only when enabled.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce19aec15b4291dc48e791d89a1f940babc22cdc
---

 libavcodec/h263.h       |    2 +-
 libavcodec/h263dec.c    |    2 +-
 libavcodec/ituh263dec.c |   12 +++++++-----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index 91dd548..a8d266d 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -110,7 +110,7 @@ int av_const h263_get_picture_format(int width, int height);
 
 void ff_clean_h263_qscales(MpegEncContext *s);
 int ff_h263_resync(MpegEncContext *s);
-const uint8_t *ff_h263_find_resync_marker(const uint8_t *p, const uint8_t *end);
+const uint8_t *ff_h263_find_resync_marker(MpegEncContext *s, const uint8_t *p, const uint8_t *end);
 int ff_h263_get_gob_height(MpegEncContext *s);
 void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index e6d9ed3..7141d49 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -170,7 +170,7 @@ static int decode_slice(MpegEncContext *s){
 
     if (s->avctx->hwaccel) {
         const uint8_t *start= s->gb.buffer + get_bits_count(&s->gb)/8;
-        const uint8_t *end  = ff_h263_find_resync_marker(start + 1, s->gb.buffer_end);
+        const uint8_t *end  = ff_h263_find_resync_marker(s, start + 1, s->gb.buffer_end);
         skip_bits_long(&s->gb, 8*(end - start));
         return s->avctx->hwaccel->decode_slice(s->avctx, start, end - start);
     }
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 68dee70..a7d8d20 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -207,16 +207,18 @@ static int h263_decode_gob_header(MpegEncContext *s)
  * @param end pointer to the end of the buffer
  * @return pointer to the next resync_marker, or end if none was found
  */
-const uint8_t *ff_h263_find_resync_marker(const uint8_t *av_restrict p, const uint8_t *av_restrict end)
+const uint8_t *ff_h263_find_resync_marker(MpegEncContext *s, const uint8_t *av_restrict p, const uint8_t *av_restrict end)
 {
     av_assert2(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;
+    if(s->resync_marker){
+        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;



More information about the ffmpeg-cvslog mailing list