OSDN Git Service

Merge commit 'a2fd547839d3ef8f342b6f2c096d0887675d3b1a'
authorClément Bœsch <u@pkh.me>
Sun, 19 Jun 2016 11:03:31 +0000 (13:03 +0200)
committerClément Bœsch <u@pkh.me>
Sun, 19 Jun 2016 11:04:17 +0000 (13:04 +0200)
* commit 'a2fd547839d3ef8f342b6f2c096d0887675d3b1a':
  h264_refs: reorder functions to avoid forward declarations

Merged-by: Clément Bœsch <u@pkh.me>
1  2 
libavcodec/h264_refs.c

@@@ -181,39 -167,41 +181,70 @@@ static void h264_initialise_ref_list(H2
          if (len < sl->ref_count[0])
              memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len));
      }
 +#ifdef TRACE
 +    for (i = 0; i < sl->ref_count[0]; i++) {
 +        ff_tlog(h->avctx, "List0: %s fn:%d 0x%p\n",
 +                (sl->ref_list[0][i].parent ? (sl->ref_list[0][i].parent->long_ref ? "LT" : "ST") : "??"),
 +                sl->ref_list[0][i].pic_id,
 +                sl->ref_list[0][i].data[0]);
 +    }
 +    if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
 +        for (i = 0; i < sl->ref_count[1]; i++) {
 +            ff_tlog(h->avctx, "List1: %s fn:%d 0x%p\n",
 +                    (sl->ref_list[1][i].parent ? (sl->ref_list[1][i].parent->long_ref ? "LT" : "ST") : "??"),
 +                    sl->ref_list[1][i].pic_id,
 +                    sl->ref_list[1][i].data[0]);
 +        }
 +    }
 +#endif
 +
 +    for (j = 0; j<1+(sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) {
 +        for (i = 0; i < sl->ref_count[j]; i++) {
 +            if (sl->ref_list[j][i].parent) {
 +                if (mismatches_ref(h, sl->ref_list[j][i].parent)) {
 +                    av_log(h->avctx, AV_LOG_ERROR, "Discarding mismatching reference\n");
 +                    memset(&sl->ref_list[j][i], 0, sizeof(sl->ref_list[j][i]));
 +                }
 +            }
 +        }
 +    }
 +    for (i = 0; i < sl->list_count; i++)
 +        h->default_ref[i] = sl->ref_list[i][0];
  }
  
- static void print_short_term(H264Context *h);
- static void print_long_term(H264Context *h);
+ /**
+  * print short term list
+  */
+ static void print_short_term(H264Context *h)
+ {
+     uint32_t i;
+     if (h->avctx->debug & FF_DEBUG_MMCO) {
+         av_log(h->avctx, AV_LOG_DEBUG, "short term list:\n");
+         for (i = 0; i < h->short_ref_count; i++) {
+             H264Picture *pic = h->short_ref[i];
+             av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n",
+                    i, pic->frame_num, pic->poc, pic->f->data[0]);
+         }
+     }
+ }
+ /**
+  * print long term list
+  */
+ static void print_long_term(H264Context *h)
+ {
+     uint32_t i;
+     if (h->avctx->debug & FF_DEBUG_MMCO) {
+         av_log(h->avctx, AV_LOG_DEBUG, "long term list:\n");
+         for (i = 0; i < 16; i++) {
+             H264Picture *pic = h->long_ref[i];
+             if (pic) {
+                 av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n",
+                        i, pic->frame_num, pic->poc, pic->f->data[0]);
+             }
+         }
+     }
+ }
  
  /**
   * Extract structure information about the picture described by pic_num in
@@@ -528,49 -504,8 +559,15 @@@ void ff_h264_remove_all_refs(H264Contex
          h->short_ref[i] = NULL;
      }
      h->short_ref_count = 0;
 +
 +    memset(h->default_ref, 0, sizeof(h->default_ref));
 +    for (i = 0; i < h->nb_slice_ctx; i++) {
 +        H264SliceContext *sl = &h->slice_ctx[i];
 +        sl->list_count = sl->ref_count[0] = sl->ref_count[1] = 0;
 +        memset(sl->ref_list, 0, sizeof(sl->ref_list));
 +    }
  }
  
- /**
-  * print short term list
-  */
- static void print_short_term(H264Context *h)
- {
-     uint32_t i;
-     if (h->avctx->debug & FF_DEBUG_MMCO) {
-         av_log(h->avctx, AV_LOG_DEBUG, "short term list:\n");
-         for (i = 0; i < h->short_ref_count; i++) {
-             H264Picture *pic = h->short_ref[i];
-             av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n",
-                    i, pic->frame_num, pic->poc, pic->f->data[0]);
-         }
-     }
- }
- /**
-  * print long term list
-  */
- static void print_long_term(H264Context *h)
- {
-     uint32_t i;
-     if (h->avctx->debug & FF_DEBUG_MMCO) {
-         av_log(h->avctx, AV_LOG_DEBUG, "long term list:\n");
-         for (i = 0; i < 16; i++) {
-             H264Picture *pic = h->long_ref[i];
-             if (pic) {
-                 av_log(h->avctx, AV_LOG_DEBUG, "%"PRIu32" fn:%d poc:%d %p\n",
-                        i, pic->frame_num, pic->poc, pic->f->data[0]);
-             }
-         }
-     }
- }
  static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
  {
      int i;