Merge commit 'bcd91f1644b46dd142c5355c8b742b27d9028903'
authorClément Bœsch <u@pkh.me>
Fri, 29 Jul 2016 08:24:06 +0000 (10:24 +0200)
committerClément Bœsch <u@pkh.me>
Fri, 29 Jul 2016 08:24:06 +0000 (10:24 +0200)
* commit 'bcd91f1644b46dd142c5355c8b742b27d9028903':
  h264: move a per-field block from decode_slice_header() to field_start()

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

@@@ -1321,16 -1166,14 +1321,23 @@@ static int h264_field_start(H264Contex
      } else {
          release_unused_pictures(h, 0);
      }
 +    /* Some macroblocks can be accessed before they're available in case
 +    * of lost slices, MBAFF or threading. */
 +    if (FIELD_PICTURE(h)) {
 +        for(i = (h->picture_structure == PICT_BOTTOM_FIELD); i<h->mb_height; i++)
 +            memset(h->slice_table + i*h->mb_stride, -1, (h->mb_stride - (i+1==h->mb_height)) * sizeof(*h->slice_table));
 +    } else {
 +        memset(h->slice_table, -1,
 +            (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table));
 +    }
  
+     ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc,
+                      h->ps.sps, &h->poc, h->picture_structure, nal->ref_idc);
+     memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco));
+     h->nb_mmco = sl->nb_mmco;
+     h->explicit_ref_marking = sl->explicit_ref_marking;
      return 0;
  }
  
@@@ -1665,17 -1442,8 +1672,8 @@@ int ff_h264_decode_slice_header(H264Con
                                   FIELD_OR_MBAFF_PICTURE(h);
      if (h->picture_structure == PICT_BOTTOM_FIELD)
          sl->resync_mb_y = sl->mb_y = sl->mb_y + 1;
 -    assert(sl->mb_y < h->mb_height);
 +    av_assert1(sl->mb_y < h->mb_height);
  
-     if (!h->setup_finished) {
-         ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc,
-                          h->ps.sps, &h->poc, h->picture_structure, nal->ref_idc);
-         memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco));
-         h->nb_mmco = sl->nb_mmco;
-         h->explicit_ref_marking = sl->explicit_ref_marking;
-     }
      ret = ff_h264_build_ref_list(h, sl);
      if (ret < 0)
          return ret;