[FFmpeg-cvslog] lavc/h264: move history parsing variable to H264ParseContext

Clément Bœsch git at videolan.org
Sun Jun 19 12:41:33 CEST 2016


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Jun 19 12:38:28 2016 +0200| [34ec084b84817ca0b00544ca8e1029e6073c1e51] | committer: Clément Bœsch

lavc/h264: move history parsing variable to H264ParseContext

This makes h264_find_frame_end() not depend on H264Context anymore.

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

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

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 1dd4bc1..bd4b865 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -684,10 +684,6 @@ typedef struct H264Context {
     int cur_bit_depth_luma;
     int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
 
-    uint8_t parse_history[6];
-    int parse_history_count;
-    int parse_last_mb;
-
     int enable_er;
 
     H264SEIContext sei;
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index be7e7ab..4f28ba7 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -55,13 +55,15 @@ typedef struct H264ParseContext {
     int is_avc;
     int nal_length_size;
     int got_first;
+    uint8_t parse_history[6];
+    int parse_history_count;
+    int parse_last_mb;
 } H264ParseContext;
 
 
 static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
                                int buf_size, void *logctx)
 {
-    H264Context *h = &p->h;
     int i, j;
     uint32_t state;
     ParseContext *pc = &p->pc;
@@ -115,15 +117,15 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
             }
             state = 7;
         } else {
-            h->parse_history[h->parse_history_count++]= buf[i];
-            if (h->parse_history_count>5) {
-                unsigned int mb, last_mb= h->parse_last_mb;
+            p->parse_history[p->parse_history_count++] = buf[i];
+            if (p->parse_history_count > 5) {
+                unsigned int mb, last_mb = p->parse_last_mb;
                 GetBitContext gb;
 
-                init_get_bits(&gb, h->parse_history, 8*h->parse_history_count);
-                h->parse_history_count=0;
+                init_get_bits(&gb, p->parse_history, 8*p->parse_history_count);
+                p->parse_history_count = 0;
                 mb= get_ue_golomb_long(&gb);
-                h->parse_last_mb= mb;
+                p->parse_last_mb = mb;
                 if (pc->frame_start_found) {
                     if (mb <= last_mb)
                         goto found;



More information about the ffmpeg-cvslog mailing list