[FFmpeg-cvslog] libavcodec/h264_parser: Increase parse_history, fix huge resolutions

Michael Niedermayer git at videolan.org
Tue Aug 5 04:58:08 CEST 2014


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Thu Jul 31 16:25:21 2014 +0200| [cdaf9fb2a054519ecc56339d511863bd46c935b3] | committer: Michael Niedermayer

libavcodec/h264_parser: Increase parse_history, fix huge resolutions

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 0782fb6bcb32fe3ab956a99af4cc472ff81da0c2)

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

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

 libavcodec/h264.h        |    2 +-
 libavcodec/h264_parser.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 4a41fff..188e749 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -691,7 +691,7 @@ typedef struct H264Context {
 
     int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
 
-    uint8_t parse_history[4];
+    uint8_t parse_history[6];
     int parse_history_count;
     int parse_last_mb;
     uint8_t *edge_emu_buffer;
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 4432871..416f464 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -91,7 +91,7 @@ static int h264_find_frame_end(H264Context *h, const uint8_t *buf,
             state = 7;
         } else {
             h->parse_history[h->parse_history_count++]= buf[i];
-            if (h->parse_history_count>3) {
+            if (h->parse_history_count>5) {
                 unsigned int mb, last_mb= h->parse_last_mb;
                 GetBitContext gb;
 
@@ -119,7 +119,7 @@ found:
     pc->frame_start_found = 0;
     if (h->is_avc)
         return next_avc;
-    return i - (state & 5) - 3 * (state > 7);
+    return i - (state & 5) - 5 * (state > 7);
 }
 
 static int scan_mmco_reset(AVCodecParserContext *s)



More information about the ffmpeg-cvslog mailing list