[FFmpeg-cvslog] Merge commit 'debca90863e4ee53447efd02483c500f89766384'

Clément Bœsch git at videolan.org
Wed Jul 27 19:08:39 EEST 2016


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Wed Jul 27 18:07:30 2016 +0200| [6c41eda18ec0ef48763e1672266f7563f05775a5] | committer: Clément Bœsch

Merge commit 'debca90863e4ee53447efd02483c500f89766384'

* commit 'debca90863e4ee53447efd02483c500f89766384':
  h264: store {curr,max}_pic_num in the per-slice context

Merged-by: Clément Bœsch <u at pkh.me>

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

 libavcodec/h264.h       | 12 ++----------
 libavcodec/h264_refs.c  | 10 +++++-----
 libavcodec/h264_slice.c | 13 +++++--------
 3 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index ceec2c3..210b2b2 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -465,6 +465,8 @@ typedef struct H264SliceContext {
     int poc_lsb;
     int delta_poc_bottom;
     int delta_poc[2];
+    int curr_pic_num;
+    int max_pic_num;
 } H264SliceContext;
 
 /**
@@ -588,16 +590,6 @@ typedef struct H264Context {
 
     H264POCContext poc;
 
-    /**
-     * frame_num for frames or 2 * frame_num + 1 for field pics.
-     */
-    int curr_pic_num;
-
-    /**
-     * max_frame_num or 2 * max_frame_num for field pics.
-     */
-    int max_pic_num;
-
     H264Ref default_ref[2];
     H264Picture *short_ref[32];
     H264Picture *long_ref[32];
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 6bac897a..730471b 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -305,7 +305,7 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
     h264_initialise_ref_list(h, sl);
 
     for (list = 0; list < sl->list_count; list++) {
-        int pred = h->curr_pic_num;
+        int pred = sl->curr_pic_num;
 
         for (index = 0; index < sl->nb_ref_modifications[list]; index++) {
             unsigned int modification_of_pic_nums_idc = sl->ref_modifications[list][index].op;
@@ -320,7 +320,7 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
                 const unsigned int abs_diff_pic_num = val + 1;
                 int frame_num;
 
-                if (abs_diff_pic_num > h->max_pic_num) {
+                if (abs_diff_pic_num > sl->max_pic_num) {
                     av_log(h->avctx, AV_LOG_ERROR,
                            "abs_diff_pic_num overflow\n");
                     return AVERROR_INVALIDDATA;
@@ -330,7 +330,7 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
                     pred -= abs_diff_pic_num;
                 else
                     pred += abs_diff_pic_num;
-                pred &= h->max_pic_num - 1;
+                pred &= sl->max_pic_num - 1;
 
                 frame_num = pic_num_extract(h, pred, &pic_structure);
 
@@ -844,8 +844,8 @@ int ff_h264_decode_ref_pic_marking(const H264Context *h, H264SliceContext *sl,
                 mmco[i].opcode = opcode;
                 if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) {
                     mmco[i].short_pic_num =
-                        (h->curr_pic_num - get_ue_golomb_long(gb) - 1) &
-                            (h->max_pic_num - 1);
+                        (sl->curr_pic_num - get_ue_golomb_long(gb) - 1) &
+                            (sl->max_pic_num - 1);
 #if 0
                     if (mmco[i].short_pic_num >= h->short_ref_count ||
                         !h->short_ref[mmco[i].short_pic_num]) {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 74e8118..1fe89c3 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -418,9 +418,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 
     memcpy(&h->poc,        &h1->poc,        sizeof(h->poc));
 
-    h->curr_pic_num      = h1->curr_pic_num;
-    h->max_pic_num       = h1->max_pic_num;
-
     memcpy(h->default_ref, h1->default_ref, sizeof(h->default_ref));
     memcpy(h->short_ref,   h1->short_ref,   sizeof(h->short_ref));
     memcpy(h->long_ref,    h1->long_ref,    sizeof(h->long_ref));
@@ -1337,7 +1334,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
     return 0;
 }
 
-static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl,
+static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
                                    const H2645NAL *nal)
 {
     const SPS *sps;
@@ -1426,11 +1423,11 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl,
     sl->mb_field_decoding_flag = picture_structure != PICT_FRAME;
 
     if (picture_structure == PICT_FRAME) {
-        h->curr_pic_num = sl->frame_num;
-        h->max_pic_num  = 1 << sps->log2_max_frame_num;
+        sl->curr_pic_num = sl->frame_num;
+        sl->max_pic_num  = 1 << sps->log2_max_frame_num;
     } else {
-        h->curr_pic_num = 2 * sl->frame_num + 1;
-        h->max_pic_num  = 1 << (sps->log2_max_frame_num + 1);
+        sl->curr_pic_num = 2 * sl->frame_num + 1;
+        sl->max_pic_num  = 1 << (sps->log2_max_frame_num + 1);
     }
 
     if (nal->type == NAL_IDR_SLICE)


======================================================================

diff --cc libavcodec/h264.h
index ceec2c3,cc7dd7f..210b2b2
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@@ -588,17 -567,6 +590,7 @@@ typedef struct H264Context 
  
      H264POCContext poc;
  
-     /**
-      * frame_num for frames or 2 * frame_num + 1 for field pics.
-      */
-     int curr_pic_num;
- 
-     /**
-      * max_frame_num or 2 * max_frame_num for field pics.
-      */
-     int max_pic_num;
- 
 +    H264Ref default_ref[2];
      H264Picture *short_ref[32];
      H264Picture *long_ref[32];
      H264Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
diff --cc libavcodec/h264_refs.c
index 6bac897a,f7b7211..730471b
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@@ -844,8 -751,8 +844,8 @@@ int ff_h264_decode_ref_pic_marking(cons
                  mmco[i].opcode = opcode;
                  if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) {
                      mmco[i].short_pic_num =
-                         (h->curr_pic_num - get_ue_golomb_long(gb) - 1) &
-                             (h->max_pic_num - 1);
 -                        (sl->curr_pic_num - get_ue_golomb(gb) - 1) &
++                        (sl->curr_pic_num - get_ue_golomb_long(gb) - 1) &
+                             (sl->max_pic_num - 1);
  #if 0
                      if (mmco[i].short_pic_num >= h->short_ref_count ||
                          !h->short_ref[mmco[i].short_pic_num]) {
diff --cc libavcodec/h264_slice.c
index 74e8118,d926884..1fe89c3
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@@ -418,10 -405,6 +418,7 @@@ int ff_h264_update_thread_context(AVCod
  
      memcpy(&h->poc,        &h1->poc,        sizeof(h->poc));
  
-     h->curr_pic_num      = h1->curr_pic_num;
-     h->max_pic_num       = h1->max_pic_num;
- 
 +    memcpy(h->default_ref, h1->default_ref, sizeof(h->default_ref));
      memcpy(h->short_ref,   h1->short_ref,   sizeof(h->short_ref));
      memcpy(h->long_ref,    h1->long_ref,    sizeof(h->long_ref));
      memcpy(h->delayed_pic, h1->delayed_pic, sizeof(h->delayed_pic));



More information about the ffmpeg-cvslog mailing list